javascript - How to select child tag by closest tag in jQuery -


i have select element in jquery used clicked. try parent that's not worked try closest tag in jquery

$(this).closest('.posts').children('.cbl h1').html('1') 

i try , it's work fine selection means select tag .cbl h1 successfully. tell me how can change text 1.

structure

   <div class='posts'>     <div class='cbl'>     </div> <div><div>$(this) element here</div></div>     </div> 

you can use .text() method.

something like

$(this).closest('.posts').children('.cbl h1').text('1'); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -