Results 1 to 3 of 3
Dec 23, 2011, 04:32 #1
- Join Date
- Sep 2008
- 0 Post(s)
- 0 Thread(s)
Unobtrusive JS but with multiple occasions on a page.
I have a tooltip which uses a little bit of non-essential JS.
I want to use JS unobtrusively, apply an id to the tooltip and let JS do it the right way.
The problem is I could need more than one tooltip on a page, and I understand that an id should be uniquely applied.
If there was only ever a maximum of one item per page then this would be simple.
The same could be asked for any button on a page. Imagine I wanted to replace the button with a 'loading please wait' image. I would hope to apply an "id='please-wait-button'" to any button needing it, multiple times on a page, and let JS do it unobtrusively, but again, I should't use multiple id's.
What's the best way to do this?
What about using getElementByName? Can I apply a name to every tooltip / every button and call it that way? Is that the right way / best way?