开发者

I want to fill a text field in a page with a variable taken from the same page

开发者 https://www.devze.com 2023-02-25 15:59 出处:网络
I want to know how I can get the last 开发者_JAVA技巧element of $(\'span.srs\'); and assign it to a variable. Then the variable is inserted into a text field with $(\"input[name=Any]\").val();. Is tha

I want to know how I can get the last 开发者_JAVA技巧element of $('span.srs'); and assign it to a variable. Then the variable is inserted into a text field with $("input[name=Any]").val();. Is that possible or there is another way?


$("input[name=Any]").val($('span.srs:last').text());


var last = $('span.srs:last-child');
$("input[name=Any]").val(last.text());
0

精彩评论

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