开发者

jquery won't work in multi level dependency?

$(document).ready(function() { 

     $("#ddlprod").change(function() {

        var pk= $("#ddlprod").val();

        $.ajax({

        url: "ajaxprintdropdown.php",

        type: "POST",

        data开发者_StackOverflow中文版: 'pk='+pk,

        timeout: 5000,

        success:  function(output) {                            

            $('#divtesting').show();    //works well            
            $('#divtesting').html(output);   //works well
        },


        }); 


     $("#ddltesting").change(function(){
        alert('a');    //not functioning at all
        var c= $("#ddltesting").val();
        alert(c);   //not functioning at all    
      });



     });

ajaxprintdropdown.php's output

<select name=ddltesting id=ddltesting >
<option value=''>--Select--</option>
<option value='test1'>bla for test1</option>
<option value='test2'>bla for test2</option>
</select>

Jquery not working for multi level dependency? $("#ddltesting").change(function(){ no response at all


Edit

@altCognito pointed out that live works with change events also. Then you can write

$("#ddltesting").live("change",function(){
    alert('a');    
    var c= $("#ddltesting").val();
    alert(c);   
});

From jQuery 1.4 Released

The change and submit events work reliably across browsers for both normal and live events. We override the normal change and submit events in Internet Explorer and replace them with events that work identically to the other browsers.

Try

$("#sampletextbox").val(c);

instead of

$("#sampletextbox").text(c);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜