[Javascript] removeAttribute issue IE7

jeffrey morin rufus2021 at gmail.com
Tue May 4 13:37:29 CDT 2010


On Tue, May 4, 2010 at 10:30 AM, Terry Riegel
<riegel at clearimageonline.com>wrote:

> if you are calling
> > div.removeAttribute('class')
>
> Then after that it would be null.
>
> For Example if you have something like...
>
> <div class="blah"></div>
>
> then removeAttribute would make it something like...
>
> <div></div>
>
> and correspondingly div.className='' would make it something like...
>
> <div class=""></div>
>
> Hope this helps.
>
> Terry
>
>
>
> On Apr 19, 2010, at 1:11 PM, jeffrey morin wrote:
>
> > Hey everyone,
> >
> > I am editing a script that is having issues in IE7 and can't figure this
> > out. A radio button has an onclick event handler and when it is fired it
> > calls a script that removes a class name from a div element. For whatever
> > reason it doesn't work for IE7 though.
> >
> > It is very straight forward and says just this.
> >
> > var div = document.getElementById('div')
> > div.removeAttribute('class')
> >
> > I threw an alert in there to give the class name and Ie returns it as
> null.
> > The weird thing is that when I just use div.className = ' ' it works just
> > fine. Does anyone know what is going on here? I am stumped.
> >
> > Thanks,
> > - J
> > _______________________________________________
> > Javascript mailing list
> > Javascript at lists.evolt.org
> > http://lists.evolt.org/mailman/listinfo/javascript
>
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
>

Thanks for getting back to me on this. It's not a big issue, just a strange
IE quirk I guess. Thankfully it looks like IE9 will have a lot better
JavaScript support across the board.

- J


More information about the Javascript mailing list