Get value of child div using jquery

Total Post:45

Points:323
JQuery 
 588  View(s)
Ratings:
Rate this:

I want to access the content of div id second ..please help
<div id='container'>
    <div id='first'>first text</div>
    <div id='second'>Secod text</div>
    <div id='third'>Third test</div>
</div>
thanks in advance
  1. Post:19

    Points:135
    Re: Get value of child div using jquery

    //To get the textual contents of a container, you need to use text() (or html(),

       
    var text_val = $('#second').text(); 
        or
     
        var text_val = $('#container').children('#second').text();

    hope this will helps you..

      Modified On Apr-11-2018 11:07:28 PM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!