[jQuery] Another simple question...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Courier New, Courier, monospace">Hi folks,
I'm posting this again, because I'm not sure it made it through the
first time. Sounds like a user error to me! :o)
Anyway...
</font></font><font size="-1"><font
face="Courier New, Courier, monospace">I've got another simple
question. Is this not how you set an element's
attribute?
[from inside an .each()]
$(this).attr("AttributeName", "Value");
I thought that worked... I thought it had worked for me in the past.
Is there any reason that this wouldn't work:
var i = 1;
$("div.OrderEntryListRow").not(".Selected").each(function(){
alert("before: " + $(this).attr("ID"));
</font></font><font size="-1"><font
face="Courier New, Courier, monospace">
//$(this).attr("ID", "Row_" + i);
</font></font><font size="-1"><font
face="Courier New, Courier, monospace"> ThisNewRow = "Row_" + i;
$(this).attr("ID", ThisNewRow);
alert("after: " + $(this).attr("ID"));
i++;
});
</font></font><font size="-1"><font
face="Courier New, Courier, monospace">What I'm expecting is that all
the elements regardless of their current ID will have those IDs
reordered starting with 1.</font></font><font size="-1"><font
face="Courier New, Courier, monospace">
In this sample code above, I should see "before: Row_4", and "after:
Row_1", like that. Instead I'm getting, "before: Row_4", and "after:
Row_4". Is there something else I'm missing about setting an element's
attribute?
I think I've got the above idea correct, but wanted to get some
different eyes to look at it with me. I've tried several different
things to get this going both jQuery and plain ol' JavaScript. This is
holding up my progress on progress on my current project which has a
deadline fast approaching.
Can someone please help me? :o(
Thanks,
Chris</font></font>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.cjordan.info">http://www.cjordan.info</a></pre>
</body>
</html>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/