View Full Version : Need code to check if exists in an elements attribute pls

05-02-2006, 08:58 PM
Anybody please come up with something faster and better than this:

if ((" " +e.getAttribute("className").indexOf("make_sortable") != -1)) { //then do something }

see i want it to check if an attributes classname has make_sortable in it. Thats for potential use of multiple classnames like class="redbox boldLetters".
I want to find a once and for all solution...thanks

05-02-2006, 11:59 PM
that throws an arror if attribute doesn't exist in mozilla