johnsmith153 Posted December 23, 2011 Share Posted December 23, 2011 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? Thanks. Quote Link to comment Share on other sites More sharing options...
haku Posted December 23, 2011 Share Posted December 23, 2011 What exactly is the problem you are running into? Of course you shouldn't use the same ID multiple times, but there are many ways around this. But without knowing what you are trying and what isn't working, it's hard to help. Quote Link to comment Share on other sites More sharing options...
trq Posted December 23, 2011 Share Posted December 23, 2011 If you use a selector framework you can easily locate elements via class selectors. jQuery and many other frameworks provide this functionality. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.