I need to change the style of the Quantity textbox for the “Full User License” and “Limited User License”
I want to change the style to .quantity-editable for these 2 and
I want to change the rest to .quantity-readonly
If el points to the element you want to update the class on and cl is the class to be added or removed from that element then you can do it as follows:
addClass = function(el,cl) {
var re = new RegExp('\\\\b'+cl+'\\\\b');
if (!el.className.match(re)) el.className += " "+cl;
}
removeClass function(el,cl) {
var re = new RegExp('\\\\b'+cl+'\\\\b');
if (el.className.match(re))
el.className=el.className.replace(re,' ');
}
This leaves any other classes on the same element unaffected by the add or remove and ensures the same class doesn’t get added twice.