jquery - select matching elements whose sibling element has a specific class -


i want select links direct child of table cell, have following selector:

$('td a') 

but want add filter this. want select table cell links have direct sibling class of 'moda'. in other words, following match:

<td>   <a data-target="#unresolvedtasks" data-toggle="modal" href="#" style="">dfsgdfg fghfghjhgj</a>   <div class="modal fade" id="unresolvedtasks" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> </td> 

i did google search , conditions, gave me this link. different type of , condition:

a=$('[myc="blue"][myid="1"][myid="3"]'); 

that select element meets criteria. want select element meets specific criteria , check if sibling meets specific criteria.

i tried this:

$('td a, td + div[class="modal"]') 

but doing or condition not , condition.

any suggestions?

try use

$('td > div.modal').prev('a') 

and if want loop through them

$('td').each(function(){     console.log($(this).find('div.modal').prev('a').attr('data-target')); }); 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -