Adding Custom Attribute Tags to HTML Elements

Adding Custom Attribute Tags to HTML Elements

Here's what I'm trying to do:

1) I get reference to a div that's on my page:

var theDiv = $("#" + divID);

2) Now I want to add a custom attribute tag to it, so for instance I want to add "winWidth" so that the div object now contains "winWidth=" for instance.

3) I want to set winWidth now since it's part of theDiv to a value

I'm not sure how to really do 1 + 2.  I need to do this on the fly because some javascript logic later will add these attributes dynamically to the div... outside of what the original div had...I don't care what it had, I know I have it now in a JS variable and now I want to both add some new attributes to the div, and then set them on the fly.  I don't need these attributes to be on my page, I just need them added to my div variable reference.