Did*_*evy 4 each jquery class set
我有一个包含几个总字段的页面.它们都共享"totalAmount"类.
我需要使用jquery在所有这些字段中设置相同的值:
var amt = some value;
$('.totamAmount').each // - Some instruction to set the value to amt;
Run Code Online (Sandbox Code Playgroud)
gdo*_*ica 10
只需val:
$('.totamAmount').val('{the value you want here}');
Run Code Online (Sandbox Code Playgroud)
如果它们不是表单元素,请使用文本:
$('.totamAmount').text('{the value you want here}');
Run Code Online (Sandbox Code Playgroud)