Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Javascript 中有一个变量:
var test ="whatever"
我只想在隐藏的输入中传递这个变量:
<input type="hidden" class="myinput" value="">
我试过了:
$('.myinput').attr('test');
但这似乎不起作用。
谢谢您的帮助。
.val
见下面的代码:
$('.myinput').val(test);