I would like to perform something with all my text areas, however selecting all of them with $("textarea")
wont do. Here's what I am trying to do in Pseudo code:
for each textarea do
alert(textarea.val)
In my case, I need to do a Word replacement in all of my textareas, so I thought doing it with iteration would be a lot cleaner, however I cant figure out how to do it.
Here is what I currently do, which is very tedious:
var txtcode = $("#txt_banner1").text().replace("AFFURL",producturl);
$("#txt_banner1").text(txtcode);
var txtcode = $("#txt_banner2").text().replace("AFFURL",producturl);
$("#txt_banner2").text(txtcode);
... and on and on....
Thanks!
$(function(){
$("textarea").each(function(){
this.value = this.value.replace("AFFURL",producturl);
});
});
See a working demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With