jQuery get value within child div

Total Post:3

Points:23
JQuery 
 473  View(s)
Ratings:
Rate this:

I am trying to access the value of div whose id is second

<div id='container'>

    <div id='first'>HI</div>
    <div id='second'>Mindstick</div>
    <div id='third'>Software</div>
</div>


  1. Post:4

    Points:28
    Re: jQuery get value within child div

    //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:36:34 PM

Answer