lundi 12 janvier 2015

Clearing TextBox with hardcoded value?


Lets say I have a HTML textbox



<input class="searchinfo" type="text" id="search1" name="search[lastname]" value="<?php echo search['lastname']; ?>" />


If the user submits a value in the box it will prefill when the page reloads....


Trying to use jquery or just plain javascript to clear the value from the box if the reset button is clicked.


My code doesn't work.


http://ift.tt/1xhw8fv



$("#reset").click(function() {
$('#search1').val("");
$('#search2').val("");
$('#search3').val("");
$('#search4').val("");
$('#search5').val("");
$('#search6').val("");
$('#search7').val("");
$('#search8').val("");
$('#hostnames').val("");
$('#cpuserials').val("");
$('#hddserials').val("");
$('#lanids').val("");
$('#empids').val("");
$('input[type=text]').each(function() {
$(this).val('');
});
$('textarea').each(function() {
$(this).val('');
});
});




Aucun commentaire:

Enregistrer un commentaire