2
See, I have 5 IDS(5 DOM elements) and accurate, using Jquery’s text() function, add to each of them a different text, I can do so..
$("#ID1").text("bla");
$("#ID2").text("blabla");
....
There is a smaller, simplified way to do this, if the texts were equal, you could comma the selectors, but they’re not..
I thought of something like:
.text(function() {
$("#ID1") = "bla";
$("#ID2") = "blabla";
});
Anyway, any suggestions, even for good practice and to keep the code simplified and clean.
Where does this text come from? can you have this text in an array to make the most auto-magic code? Another question: Ids differ only by number?
– Sergio
see this example using a basic function: http://jsfiddle.net/z7Leskqb/
– Wallace Maxters
Alexandre saw my comment above?
– Sergio
@Sergio, the text is static, it is not generated randomly, or anyway, but are 5 different texts. You can put it in an array. IDS do not differ by numbers, they are totally different.
– Ale
Interesting @Wallacemaxters, I’ll see better how it works!
– Ale