On Sep 4, 11:28 am, p_W <paulwoolcoc...@gmail.com> wrote:
> I just wanted to address setAttribute real quick...correct me if I'm
> wrong, but I was under the impression that IE does not support
> setAttribute(), that you had to use dot notation for IE (so
> element.attribute = value instead of element.setAttribute("attribute",
> "value"))

setAttribute "works" in IE as far back as 6 at least, but has quirks
(try using it to set an onclick listener). There is rarely any need to
set HTML attributes when dealing with an HTML DOM, just set the
appropriate property.

setAttribute and getAttribute are useful for DOMs that are not HTML,
or for non-standard attributes in an HTML DOM - though that makes the
markup invalid and so shouldn't be used. Again, just use standard
object property access methods (dots or square brackets).


--
Rob

Reply via email to