how can i set a value to a textbox array element using jquery. i have an array of select and corrosponding textbox(array). when i select a diff value from the dropdown, it shud automatically populate the textbox cor开发者_Python百科rosponding to it. also remember this select and textbox are created dynamically.
thanks in advance
Just do something like this:
var $text = $('#textbox'), $select = $('#selectMenu').change(function(){
$text.val($select.val())
})
$('#myTextBox').val($('#mySelectBox').val());
You can add onChange to the select box to call the js function to do the above.
You should try something like :
$(function () {
function changed(select) {
var newVal = select.value;
${"#yourTextBoxID"}.val(newVal);
}
});
... and on your select
onchange="changed(this)"
精彩评论