jquery - pass two selectors into .parents() method -


there 2 containers 'cont1' , 'cont2'. within each there 1 html element can clicked. want know under container element clicked want check whether clicked element has parent 'cont1' or 'cont2' , one. tried pass these both containers identifiers jquery selector didn't return elements:

$(html_elem).click(function(e) {      var parent = $(e.currenttarget).parents('#cont1', '#cont2'); //parent undefined }); 

however, when test whether 1 particular parent there, works

$(html_elem).click(function(e) {      var parent = $(e.currenttarget).parents('#cont1'); //parent found }); 

am right assume .parents() method doesn't work multiple selectors?

use 1 string, comma contained within.

var parent = $(e.currenttarget).parents('#cont1, #cont2'); 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -