Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Adding new Custom Attribute to a HTML element.

Reply
Thread Tools

Adding new Custom Attribute to a HTML element.

 
 
kewp kewp is offline
Junior Member
Join Date: Feb 2010
Posts: 2
 
      02-15-2010
well i just wrote the following html

<div id="mydiv" thing="hi"> </div>

and the following javascript worked in chrome, ie and firefox

mydiv = document.getElementById("mydiv");
alert(mydiv.getAttribute("thing"));

...
 
Reply With Quote
 
 
 
 
michaelhugs michaelhugs is offline
Junior Member
Join Date: Mar 2010
Posts: 1
 
      03-19-2010
Quote:
Originally Posted by kewp
well i just wrote the following html

<div id="mydiv" thing="hi"> </div>

and the following javascript worked in chrome, firefox and ie

alert(document.getElementById("mydiv").getAttribut e("thing"));

...
Verified. kewp, you tha man!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding new parent element by matching child attribute value madmaler@googlemail.com XML 1 02-19-2008 11:37 AM
JSP Custom Tags as attribute values for other custom tags Dave Java 0 08-14-2006 02:21 PM
picking value of one attribute based on a child elements attribute? XPath? vjethava@gmail.com XML 2 03-06-2006 05:19 AM
XSLT: Making attribute to parent attribute Bostonasian XML 1 09-18-2005 07:30 AM
Getting HTML style attribute in Custom WebControl msnews.microsoft.com ASP .Net Web Controls 3 11-03-2003 10:29 AM



Advertisments