Answers for "how to get class attribute in jquery"

8

jquery get class name

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

class with attribute selector jquery

$('.myclass[reference="12345"]')
Posted by: Guest on August-13-2021
5

jquery find tag and class

$(".txtClass")                  =>  getElementsByClassName()

$("#childDiv2 .txtClass")       =>  getElementById(),
                                    then getElementsByClassName()

$("#childDiv2 > .txtClass")     =>  getElementById(),
                                    then iterate over children and check class

$("input.txtClass")             =>  getElementsByTagName(),
                                    then iterate over results and check class

$("#childDiv2 input.txtClass")  =>  getElementById(),
                                    then getElementsByTagName(),
                                    then iterate over results and check class
Posted by: Guest on August-15-2020

Code answers related to "how to get class attribute in jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language