开发者

A problem in time line rendering of server/client controls with javascript, jQuery and php

I have two text boxes (select) which I want to change the contents of the second according to the selection of the first. I draw them with jQuery functions and handle the event like that as well. But I think I am mistaken to handle the event of changed selected index of the first one by jQuery because the page would 开发者_运维问答have already been loaded. So any suggestions how to solve that out?


not sure what you mean, but if you want your second drop-down be populated depending on the first one by the time the page loads, you either populate it with PHP when dynamically creating a page, or you could trigger changed event with jquery like:

$(function() {
  $('#yuourfirstdropdown').change(function() {
    // your code here
  }).trigger('change');
});


You want to have change event on second drop down populated from the first change function. If that's your requirement, use live function.

$('select.changeddropdown').live('change',function(){
   //code here 
})

See http://api.jquery.com/live/ for more details on live function

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜