javascript - How to get html tag's inner html in js/jquery? -


for example have:

<p class="question">  paragraph    <p> , i'm inside    tag in question class       <h1> , heading</h1>    </p> </p> 

the question how can inner html of question class below:

this paragraph  <p> , i'm inside tag in question class    <h1> , heading</h1>  </p> 

there 2 functions inner html of element

  1. .text()
  2. .html()

.text()

console.log($(".question").text()); 

.text() give innertext of element not tags

.html()

console.log($(".question").html()); 

.html() function give inner tags also.

this paragraph <p> , i'm inside  tag in question class <h1> , heading </h1> </p> 

in case .html() fine


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -