Using a div as selector is easy:
<div id="test1"></div>
$('#test1').doSomething();
I want to target only another div, containing the same ID
+ _sub
:
<div id="test1"></div>
<div id="test1_sub"></div>
$('#test1').find( /* Same ID + "_sub" */ ).doSomething();
How can I do this? I know I can use .attr('id')
to take #test1, but I do not how to extend this with _sub.
Of course it would be easy to target the #test1_sub
directly, but image I have 1000 divs counting up test1
, test2
, test3
, etc. and want to use this inside of a function.