0

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

3 Answers 3

2

Is this what you are looking for?

var tag = $('#'+modal_ID).attr('tag');
console.log(tag); //'Actor'
Sign up to request clarification or add additional context in comments.

Comments

2

This will give you the tag attr

var saveTagVar = $('#'+modal_ID).attr("tag");

Comments

0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.