When to use setter methods?
Hi,
I am a little confused about when to use setter methods. For example, I have this code
- $("input[placeholder]").val($("input[placeholder]").attr("placeholder"));
should this be used like this
- $("input[placeholder]").val(function(i, value) {
- return $("input[placeholder]").attr("placeholder");
- });
I think a better question is when to use the .each loop? Since, the first line of code I have works fine.
Thanks for your help.