I am working with jquery, i want to write a text in two textbox control at a time开发者_开发技巧.
HTML
<input type="text" id="textbox1" />
<input type="text" id="textbox2" />
jQuery
$('#textbox1, #textbox2').val('some text');
HTML
<input type="text" id="textbox1" class="sameclass" />
<input type="text" id="textbox2" class="sameclass" />
JS
$('input.sameclass').val('some text')
You can use id^=
$('[id^=textbox]').val('some text');
精彩评论