selector - Select a class except another class in jquery -


this question has answer here:

i select element has .handle class not have .exception class-

html-

<div class="handle exception">  1 <div> <div class="handle">  2 <div>  $(document).on('click', '.handle', function (e) {    //i want select 2nd div. }); 

any help?

you can use :not selector

$(document).on('click', '.handle:not(.exception)', function (e) {    //i want select 2nd div. }); 

or select 2nd .handle class element can use :eq(1) or nth-child(2)

'.handle:eq(1)'  // index start 0 1 select 2nd 1 '.handle:nth-child(2)'  // index start 1 2 select 2nd 1 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -