get element by type jquery code example

Example 1: jquery find

$( "li.item-ii" ).find( "li" ).css( "background-color", "red" );

Example 2: 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

Example 3: how to target an element inside of a $(this) jquery

$( this ).find( 'li.target' ).css("border", "3px double red");