I am working on a placeholder function in jquery. Right now, I just want the form element to change its value to any of its placeholders. I tried the following code:
$('input:text').val($(this).attr('placeholder'));
But that will not work. After a little testing, I realized that the problem is using $(this) in this context. How can I change this so that it goes through all the elements of the form and changes their value to its placeholder attribute?
javascript jquery html placeholder
Zak
source share