jQuery add multiple class
This is my current code, I know its wrong code
$('.page-address-edit').addClass('test1').addClass('test2');
Absolutely, divs can have more than one class and with some Bootstrap components you'll often need to have multiple classes for them to function as you want them to. Applying multiple classes of course is possible outside of bootstrap as well. All you have to do is separate each class with a space.
The addClass() method adds one or more class names to the selected elements. This method does not remove existing class attributes, it only adds one or more class names to the class attribute. Tip: To add more than one class, separate the class names with spaces.
HTML elements can be assigned multiple classes by listing the classes in the class attribute, with a blank space to separate them.
Multiple classes can be applied to a single element in HTML and they can be styled using CSS.
$('.page-address-edit').addClass('test1 test2 test3');
Ref- jQuery
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With