Reputation: 333
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">
to
<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!
Upvotes: 3
Views: 10257
Reputation: 91
You can try this :
$('input').each(function(index, value) {
$(this).attr('placeholder','Benutzer');
});
Upvotes: 0
Reputation: 318232
Target elements based on the attribute, then change it
$('input[placeholder="User"]').attr('placeholder', 'Benutzer')
Upvotes: 10