开发者

JQuery Update values by ID and similar id

开发者 https://www.devze.com 2023-02-11 10:57 出处:网络
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.

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

精彩评论

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