I have the following script which works:
classes = $(this).attr("class").split('_');
If $(this)
's class was:
class="billed_department_employee_client_code"
The end result would look like this:
["billed", "department", "employee", "client", "code"]
This is exactly what I want as it allows me to do stuff like this
console.log( classes[0] );
console.log( classes[1] );
console.log( classes[2] );
console.log( classes[3] );
Is it possible to remove a single value from classes
and move the rest of the values back?
For example,
if classes
contains department
, remove it. So, if it looks like this:
["billed", "department", "employee", "client", "code"]
it should become:
["billed", "employee", "client", "code"]
How can this be done?