i have a problem to add a new attribute to an existing html string.
First i read the HTML-code from a editor and save it as String.
Then i can acces attributes from this string with:
$("img", $(htmlString)).attr("src");
But if i try to add a new attribute (eg. name), it doesn't work. To do this i try:
$("img", $(htmlString)).attr("name", "fooo");
So my problem is, that i need to add a new attribute with some value and at the end i should have a new HTML-string wich contains the old HTML code with the new added attributes. I hope someone can help me.
data()method is a better choice all around.