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


i have new row added table buttton click , have select element each row , name "code[]".i have make value "abc" selected when new row being added table

alert($('#mytabl tr:last :input').find('input[name="code[]"]').children($('option[value=abc]')).attr('selected','selected'));  above statement no effect being done  

it seems selector overly complicated, , not selecting <select> element, looking <input> inside :input currently, try instead:

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

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -