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

insert href into table cell using javascript

P: 92
Hi,

I want to insert href into tabel cell using javascript. Note should support all browser.

I know to insert, but it support only in IE, I checked in firefox, it does not support so please help me.

This is code to insert(works in IE)

Expand|Select|Wrap|Line Numbers
  1. var myLink = document.createElement('a'); 
  2. var href = document.createAttribute('href'); 
  3. myLink.setAttribute('href','javascript:removeRow('+pos+')'); 
  4. myLink.innerText ="Delete"; 
  5. newCell.appendChild(myLink);
May 12 '10 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
.innerText is only supported by IE. either explicitly create a Text node or use .innerHTML or .textContent.

PS. you don’t use line #2 at all …
May 12 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.