Results 1 to 3 of 3

Thread: SetAttribute not working

  1. #1
    Join Date
    Jan 2009
    Posts
    576

    SetAttribute not working

    i was working with some coding but i found my self in trouble when i got that setAttribute is not working. i used in internet explorer 6,7 but not working please anyone can help me to find out what is wrong ?

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: SetAttribute not working

    This is probably because IE considers setAttribute as setting the property of the actual javascript object. By setting the style attribute on a node, IE interprets it as setting node.style, which is not the actual attribute (node.style being an array of the different css settings instead). That's also why you can't set the 'class' or 'for' attributes, because on a element object, the old method of setting class and the for attribute are node.className and node.htmlFor.


    When calling the DOM method .setAttribute( attName, attValue ); in IE, there are several circumstances where it will not work.
    Setting the "name" attribute does not work, the "colspan" & "rowspan" attributes for th and td tags does not work, the "frameborder" attribute on iframes does not work.

  3. #3
    Join Date
    Dec 2008
    Posts
    207

    Re: SetAttribute not working

    Using the DOM Methods to build up new content for your page, be aware that in IE, you can't pre-check a radio button or a checkbox using .setAttribute('checked', 'checked'); or even myCheckBoxObject.checked = true; *unless* you add the element to the page first.

Similar Threads

  1. Replies: 10
    Last Post: 02-05-2012, 10:55 PM
  2. Replies: 8
    Last Post: 20-12-2011, 11:39 AM
  3. Replies: 5
    Last Post: 12-08-2011, 09:53 AM
  4. Replies: 4
    Last Post: 26-07-2009, 12:37 AM
  5. Replies: 1
    Last Post: 03-07-2008, 09:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,872,758.20490 seconds with 16 queries