KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to write an if else statement in JQuery, which can change an element's class by matching 'IN' or 'OUT' . For example: I have several <DIV> tags that each have class='IN-something' or class='OUT-something' . The below would work if I knew the exact CSS class, but all I'll know is that it contains 'IN' or 'OUT'. So something like this: if ($(jRow).hasClass('IN-*')){ jRow.attr( "class", "OUT-foo" ); }else{ jRow.attr( "class", "IN-foo"); } Does anyone have any helpful ideas?
Tags (comma-separated)
Save Edits
Cancel