Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get <p> tag content using jQuery

I want to get the content of the `P' tag from the following html code using jQuery.

<div id="div_id_disciplina" class="form-group  ">
<label for="id_disciplina" class="control-label  ">
    Disciplina
</label>
<div class="">
    <ul class="token-input-list-facebook">
        <li class="token-input-token-facebook">
            <p>Áudio e Vídeo</p>
            <span class="token-input-delete-token-facebook">×</span>
        </li>
        <li class="token-input-input-token-facebook">
            <input type="text" autocomplete="off" id="token-input-id_disciplina">    
        </li>
    </ul>
    <textarea class="form-control" id="id_disciplina" name="disciplina"></textarea>
</div>

How to achieve it? Thanks in advance.

like image 641
Alex Pereira Avatar asked Jul 19 '14 15:07

Alex Pereira


1 Answers

Query it with $('p') and use the .text() function to get the innerHTML as text.

$('p').text()
like image 185
Wio Avatar answered Sep 28 '22 11:09

Wio