Hi. Thanks. That was what I needed.
Kr. Luke. On Nov 26, 6:04 pm, Rick van Hoeij <rickvho...@gmail.com> wrote: > Hey, > > Best way to make sure that the form has been loaded is to use the load > callback function: > > $('#formGen1').load('formGen1.jsp', function(){ > //Callback function: Form has been loaded > //Code implementation > > }); > > I usualy hide the form that I'm editing until it is ready to be shown. > Simple hide() and show(). > Hope this helps. > > Greetz, > > Rick > > On 26 nov, 01:25, edencane <edenc...@gmail.com> wrote: > > > Hi. > > > I have the following document.ready: > > > $(document).ready(function(){ > > $('#formGen1').load('formGen1.jsp'); > > if(${membership eq 'propertyContractor'}) { > > $('#formGen2').load('formGen2.jsp'); > > $('#formGen3a').load('formGen3a.jsp'); > > } else if (${membership eq 'cleaningContractor'}) { > > $('#formGen2').load('formGen2.jsp'); > > $('#formGen3a').load('formGen3b.jsp'); > > $('#formGen3b').load('formGen4.jsp'); > > $('#formGen4').load('formGen3a.jsp'); > > } else if (${membership eq 'staff'}) { > > $('#formGen2').load('formGen3a.jsp'); > > } > > $(window).load(function () { > > alert($('#dob').prev().html()); > > //run code > > }); > > > }); > > > the html loaded in 'formGen1' is: > > <fieldset> > > <legend>Personal details</legend> > > <p><label for="name">Name</label> > > <input class="required" type="text" id="name" name="name"/> > > <span></span></p> > > <p><label for="dob">Date of birth</label> > > <input type="text" class="expanddate" id="dob" name="dob" value="" > > format="date"> > > <span></span></p> > > </fieldset> > > > What I want to do is add an element after the #dob element. > > In the 's$(window).load' statement I am showing the html of the > > previous element as some feedback... > > As I understand it, $(window).load should kick in after all the pages > > have loaded, but clearly in my case something else is going on... i.e. > > the pages havent loaded yet... > > > How can I do this? > > > Thanks. > > > Kind regards. > > Luke.