I have 4 inputs with different placeholders, I need when a user change/select another language all the placeholders changes. How can I change the string in all placeholders with jquery on change country? Thank you.
Asked
Active
Viewed 108 times
-1
-
Possible duplicate of [Change an HTML5 input's placeholder color with CSS](https://stackoverflow.com/questions/2610497/change-an-html5-inputs-placeholder-color-with-css) – Aman Garg Apr 17 '18 at 10:21
1 Answers
0
Its pretty simple actually:
$('combobox').change(function () {
var language = $('combobox').val()
/** Get the strings from somewhere */
$('input[type=text]').each(function(i, input) {
$(input).attr('placeholder', new_placeholder);
});
});

Vitor Villar
- 1,855
- 18
- 35
-
it seems that you are working with just one input, but in my case I have three language and four inputs with different placeholders, so i want when a user change language the foor placeholders changes with another placeholders... – User123JS Apr 17 '18 at 10:29
-
yeah, I got it, but with this line: `$('input[type=text]').each` you are looping each input text you have, that means the 4 you have. You just need to map them and put the right placeholder – Vitor Villar Apr 17 '18 at 10:44