JQuery Update values by ID and similar id
I'm trying to update values of hidden fields with those of their similar inputs. I have missed something as it is not working. Here开发者_JAVA百科 is the code.
function livecntupdate() {
$('input').each(function(){
$(this).val($('CNT' + this.id).val())
});
}
Marvellous
You are missing hash #
there needed for the id
:
function livecntupdate() {
$('input').each(function(){
$(this).val($('#CNT' + this.id).val())
});
}
精彩评论