0
私はいくつかのボタンと選択ボックスがあります。ボタンをクリックすると、AJAXリクエストを送信して、{"ids":{"attr_id":"1","subattr_id":"6"}}
attr_id
ここにselectboxに設定した値が返されます。 attr_id
によれば、第2の選択ボックスが生成され、その値はsubattr_id
に設定する必要があります。 .onClick()
ボタンイベント:第二の選択ボックスのdidntの交換のjquery .live()、イベントバインディングとajax
$.post(
function(result){
jQuery(result.ids).each(function(){
var prodAttr = $(this).attr('attr_id');
$('div.attribute_wrapper select.property').change(function(e,eType){
if(eType == 'click')
{
prodSubattr = $(result.ids).attr('subattr_id');
$(this).trigger('cascadeSelect',prodAttr);
//select.subProperty generated by ajax when first selectbox changed
$('select.subProperty').trigger('setValue',prodSubattr);
}
});
$('div.attribute_wrapper select.property').trigger('change',e.type);
$('select.subProperty').live('setValue', function(e, subAttr){
$(this).val(subAttr);
});
});
}
)
値。 だから私はこの問題についていくつかの助けが必要です。
setValueのは、第一選択ボックスが変更されたとき、私はトリガーにしたい私のカスタムイベント、です。 –