开发者

How to make the Select Box Value selected to specific value "ABC" when new row is being added to table

开发者 https://www.devze.com 2023-01-25 19:56 出处:网络
I have a new row added to table with a buttton click andwe have select element for each row and with name \"code[]\".I have to make the value \"ABC\"as selectedwhen a new row is being added to the ta

I have a new row added to table with a buttton click and we have select element for each row and with name "code[]".I have to make the value "ABC" as selected when a new row is being added to the table

alert($('#mytabl tr:last :input').find('input[name="code[]"]').children($('option[value=ABC]')).attr('selected','开发者_如何转开发selected'));

with the above statement no Effect is being done 


It seems like your selector is overly complicated, and not selecting a <select> element, but looking for a <input> inside a :input currently, try this instead:

$('#mytabl tr:last select[name="code[]"]').val('ABC');
0

精彩评论

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