Suppose I have two p tags in the document. I want to call two different effects using jQuery when onMouseOver event happens. Is it necessary that these two p tags be given Ids. Can’t it be achieved without giving Ids to these tags ?
Suppose I have two p tags in the document. I want to call two
Share
You don’t have to give anything an
id, however it is the best way to uniquely identify an element.You can instead idenfity by class:
By attribute:
By position in parent:
A full list of selectors is available in the documentation