javascript - If I assign the results of a jQuery selector to a variable, how can I further filter that? -


i have this:

var startdate = $(".startdate"); 

..which should select elements class 'startdate'.

i try following:

startdate(".nodate").hide(); 

...to hide elements 'nodate' css class fails.

i'm guessing @ syntax here, silly mistake making?

edit: 'nodate' elements not @ same level 'startdate' elements. should have posted xhtml snippet.

there couple of ways :

$('.startdate').find('.nodate').hide(); $('.nodate','.startdate').hide() $('.startdate > .nodate').hide() $('.startdate').children('.nodate').hide() $('.nodate').filter(':parent(is(.startdate))') 

my preferred way first one, saw second 1 somewhere didn't used it. can't remember other way yet. when remember update post.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -