I am working on an ASP.NET page in which I generate some JavaScript code based on values in a database.
For example, in the database there might be the formula sum([#itemA])
, which would evaluate to something like $('#itemA').change(function(){ sum(this); });
.
I know that I can select elements using jQuery selectors such as $('[id*=itemA]')
or $('[class*=itemA]')
, but I am wondering if there is any way to combine these selectors so that any element with either a class or an ID of itemA
would be selected.
Right now in my code I am just using if/else
blocks to deal with ID's or classes, but if there is an easier implementation, I would love to use it.
I looked at the jQuery documentation and googled around a bit, but I didn't see anything that answered my question.
Thanks in advance!