Well... damn. The divs I'm accessing look like this:
<div ID="Row_1"></div>
So, I thought I needed to keep the case as I wrote it.
Oddly enough, $(this).attr("ID"); returns the correct value. So when
getting the value case doesn't matter, but when setting it does? :o'
Um... okay.
Thanks for your help Dave! I appreciate it. Now, on to my other
problems. :o)
Cheers,
Chris
Dave Methvin wrote:
Try lowercase.
------------------------------------------------------------------------
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
*On Behalf Of *Christopher Jordan
*Sent:* Thursday, January 04, 2007 6:15 PM
*To:* jQuery Discussion.
*Subject:* [jQuery] setting an attribute... I *thought* this was how
to doit...
Hi folks,
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"));
$(this).attr("ID", "Row_" + i);
alert("after: " + $(this).attr("ID"));
i++;
});
In this sample code above, the before and after alerts are identical.
Is there something else I'm missing?
I think I've got the above idea correct, but wanted to get some
different eyes to look at it with me.
Thanks,
Chris
--
http://www.cjordan.info
------------------------------------------------------------------------
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
--
http://www.cjordan.info
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/