html - Want to select a img using class and data-value using jquery multiple selector -


i want select img batch of imgs using jquery multiple selector.

$('.selected-yes') 

return this

[img src=​"" class=​"partselect selected-yes" style=​"margin-top:​ 5px;​ width:​ 50px;​ height:​ 50px;​" data-matvalue=​"p1_m1" data-partvalue=​"p1">,  img src=​"" class=​"partselect selected-yes" style=​"margin-top:​ 5px;​ width:​ 50px;​ height:​ 50px;​" data-matvalue=​"p2_m1" data-partvalue=​"p2",  <img src=​"/​images/​septwolvesui/​mats/​p3_m1.jpg" class=​"partselect selected-yes" style=​"margin-top:​ 5px;​ width:​ 50px;​ height:​ 50px;​" data-matvalue=​"p3_m1" data-partvalue=​"p3">​,  img src=​"" class=​"partselect selected-yes" style=​"margin-top:​ 5px;​ width:​ 50px;​ height:​ 50px;​" data-matvalue=​"p4_m1" data-partvalue=​"p4">,  <img src=​"" class=​"partselect selected-yes" style=​"margin-top:​ 5px;​ width:​ 50px;​ height:​ 50px;​" data-matvalue=​"p5_m1" data-partvalue=​"p5">​,  img src=​"/​images/​septwolvesui/​mats/​p6_m1.jpg" class=​"partselect selected-yes" style=​"margin-top:​ 5px;​ width:​ 50px;​ height:​ 50px;​" data-matvalue=​"p6_m1" data-partvalue=​"p6"> ] 

i want select img have class 'selected-yes' , 'data-partvalue="p1"'. tried many thing can't find rite way

my tries:

$('.selected-yes[partvalue='p1']') syntaxerror: unexpected identifier $('.selected-yes[data-partvalue='p1']') syntaxerror: unexpected identifier 

please me select single img class 'selected-yes' , 'data-partvalue="p1"'.

your problem using singlequotes in both places , getting syntax error.

try this:

$('.selected-yes[partvalue="p1"]') 

your mistake in here:

$('.selected-yes[partvalue='p1']') treated separate statements                            ^  ^   

note: should use editor, notepad not highlight able detect using sublime or eclipse or other ide


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -