I was under the impression when using val it automatically set the value of any text box named in the selector. I have several input text boxes and would like them all to be set using val:
<input type="text" id="firstName" name="firstName" size="20" class="gotowp-input-text required">
<input type="text" id="lastName" name="lastName" size="20" class="gotowp-input-text required">
<input type="text" id="email" name="email" size="20" class="gotowp-input-text required email">
I have two sets of these input text boxes, and I am trying to set them both with:
jQuery(document).ready(function($){
$("#firstName").val("Test");
$("#lastName").val("Test2");
$("#email").val("test@test.net");
});
Please see:
https://jsfiddle.net/bg1pdbw2/
jQuery will set the first selector it sees but not the second one. They have the same name. Thank you guys!