By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,397 Members | 1,463 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,397 IT Pros & Developers. It's quick & easy.

getAttribute() in IE

P: n/a
Hi

I have the following code which is working in Firefox:

function showOptions() {
if(!document.getElementById) return false;
if(!document.getElementsByTagName) return false;
var lnks = document.getElementsByTagName("a");
for(var i=0; i<lnks.length; i++) {
alert(lnks[i].getAttribute("class"));
if(lnks[i].getAttribute("class") == "toggle") {
lnks[i].onclick = function() {
var options = document.getElementById("multiretailers");
options.style.display="block";
}
}
}
}

I understand that IE doesn't like he getAttribute() method and is
returning null for the class name.

What are the work arounds for this?

Thanks

M

Jun 23 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
em******@gmail.com wrote:
if(lnks[i].getAttribute("class") == "toggle") { I understand that IE doesn't like he getAttribute() method and is
returning null for the class name.


I believe IE will accept getAttribute("className") - but its probably
easier just to use lnks[i].className.

Jun 23 '06 #2

P: n/a
David Dorward wrote:
I believe IE will accept getAttribute("className") - but its probably
easier just to use lnks[i].className.


Many thanks, a great help.

M

Jun 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.