开发者

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())
    });
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜