2013-01-02 248 views
1

我有错误的jQuery选择了元素

“属性指定属性的提倡使用它总是返回true 回报VAL || val.specified elem.value的错误事件的变化:。!?ELEM 。文本;”

$(document).ready(function(){ 
    $("#o_productCategory").change(function(e){ 
     $.getJSON("URI", ({"parent" : $("#o_productCategory").val()}),function(result) { 
      //code here 
     }); 
    }); 
}); 

回答

2

错误看起来相关$("#o_productCategory").val()。可能是thisthis

由于您位于$("#o_productCategory")change回调中,因此可以使用this.value代替。

$.getJSON("URI", { "parent" : this.value }, function (result) { 
    //code here 
}); 
+0

谢谢你......它的作品! – akauts