Answers for "jquery class list"

4

jquery get class name

//jQuery get class name of element 
var className=$('#myElementID').attr('class');
Posted by: Guest on July-31-2019
1

jquery class list

$('#elementID').prop('classList');
Posted by: Guest on July-17-2020
3

get all classes of element jquery

var classList = $('#divId').attr('class').split(/\s+/);
$.each(classList, function(index, item) {
    if (item === 'someClass') {
        //do something
    }
});
Posted by: Guest on October-20-2020
1

jquery: get class list using element id

$('#elementID').prop('classList').add('yourClassName')
$('#elementID').prop('classList').remove('yourClassName')
Posted by: Guest on June-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language