开发者

Load dynamic list of elements AFTER FINISHED loading of several form elements

I have...

  • a dynamic populated select box
  • several input boxes
  • a submit button
  • form fields are loaded initially using cookies
  • several dynamic populated divs

I want...

  • start loading the content of my DIVs after all FORM elements have been loaded completely (= filled with data, select boxes are populated)

Sample code:

<script type="text/ja开发者_JAVA技巧vascript">
  $(document).ready(function() {

    // Populate <select>
    var options ='';
    for (var i = 0; i < j.length; i++) {
      options += '<option value="' + i + '">' + i +  '</option>';
    }
    $("select#myid").html(options);

  })

  ...
</script>

<form>
   <select id="myselect></select>
   <input id="mytext" type="text" value="" />    
   <input type="submit" value="Search" />    
</form>

<% foreach( MyElement element in MyListing) { %>
  <div>
    <script type="text/javascript">
       $(document).ready(function() {
         DoSomething($(select#myid).val());
       })
    </script>
  </div>
<% } %>

Any help is very appreciated.


Edited for the extra information:

jQuery(function($) {   // note that this is equivalent to $(document).load()
    // if we are here, then all your page and form elements have loaded.

    // Populate <select> as per your code above

    $('div').each(function(index) {    // perhaps give them a class?
        $(this).load(<<someURL>>);
        // it's not clear from your question how you intend to get the
        // dynamic content, ie: what url to use?
    });
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜