Reputation: 39018
So I am able to create a tag name on the fly and add it to my html
$('#'+modal_ID).attr('tag', roleName);
Will create the following html div:
<div class="modal simplemodal-data" id="modal-1" style="" tag="Actor">...
Now my question is, how do I retrieve that tag information to use elsewhere?
var saveTagVar = $('#'+modal_ID).getElementsByTagName; //Trying something like this
Upvotes: 0
Views: 114
Reputation: 33870
getElementsByTagName
Search elements with the tag indicated, but in this case, tags are nodes like div
ul
, etc.
If you want the 'tag value, use .attr('tag')
It will get the attribute value of the selected node.
Upvotes: 0
Reputation: 1789
Is this what you are looking for?
var tag = $('#'+modal_ID).attr('tag');
console.log(tag); //'Actor'
Upvotes: 2
Reputation: 104775
This will give you the tag attr
var saveTagVar = $('#'+modal_ID).attr("tag");
Upvotes: 2