I need help changing the placeholder
value on a input field with javascript, preferably JQuery.
<input id="someinput" value="" placeholder="Change This With JS" type="text">
I need help changing the placeholder
value on a input field with javascript, preferably JQuery.
<input id="someinput" value="" placeholder="Change This With JS" type="text">
demo like this: http://jsfiddle/qcNFF/ ?
Good read: http://api.jquery./prop/
code
$(function() {
alert(' Before change => ' + $('#someinput').prop('placeholder'));
$('#someinput').prop('placeholder', "text changed- hulk");
alert(' After change => ' + $('#someinput').prop('placeholder'));
});
here's a quick demo for you:
the fiddle code http://jsfiddle/nickadeemus2002/H7MG7/
just use jquery's .attr() method to changed the string.