简体   繁体   中英

document.getElementById('keylink').innerHTML = '<a ></a>'; not working in ie

As you can see from the title that code not working in IE but working in other browsers also if I use like that

document.getElementById('keylink').innerHTML = '<p>hi</p>'; 

It's working so there is problem in <a> and innerHTML please give me some solution on that

IE won't identify blank anchors.. try something like this:

document.getElementById('keylink').innerHTML = '<a href="#" onclick="return false;">hi</a>'; 

To create "dummy" link that doesn't do anything when clicked but still looks like a link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM