nearest object in html jquery code example
Example 1: jquery nearest
$( "li.item-a" )
.closest( "ul" )
.css( "background-color", "red" );
Example 2: jquery get closest form
$( this ).closest( "form" )
$( "li.item-a" )
.closest( "ul" )
.css( "background-color", "red" );
$( this ).closest( "form" )