user3532637 user3532637 - 1 year ago 93
jQuery Question

Search and replace input placeholder text with jQuery

How can I search and replace placeholder text from all input boxes?

Example: I wanna change

<input type="text" name="user" id="user" placeholder="User">


<input type="text" name="user" id="user" placeholder="Benutzer">

By something like that

$('input').each(function() {
$(this).attr("placeholder").replace('User', 'Benutzer');

Thanks and best regards!

Answer Source

Target elements based on the attribute, then change it

$('input[placeholder="User"]').attr('placeholder', 'Benutzer')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download