mari muthu

mari muthu

  • NA
  • 198
  • 107.5k

how to get Parent and Child value

Jun 27 2016 1:14 AM
hi,
 in this directly i can give a value for paragraph but i should use parent and child by using this only i am gonna give the value for Paragraph.   please help me for that
 
 Explain;
----------- 
  i want to get the Parent and Child values.buy using that in  Paragrap tag i need to give some values after i click the button i tried but am not get that value("Muthu") for Para...Please help me for this
 
<input type="button" name="New" value="New" id="Sec">
<div id="Main">
<div id="sub">
<div id="secondsub">
<p id="para"></p>
</div>
</div>
</div>
 
script:
 
$(document).ready(function () {
$("#Sec").on("click", function () {
var getvalue = $("#Main").parent().eq(2).children().first();
getvalue.text("Muthu");
});
}); 

Answers (2)