javascript - How Can I get Text Inside an Element with Children using jQuery -


I have a stored text in a variable that contains several span tags.
I have to get all the materials inside every spin immediately. How can I do this with jQuery or Javascript?

  & lt; Htmltext & gt; Research University has given a 5-star rating in the current research estimation exercise. It is one of the UK's leading technical universities, which specializes in research to provide important solutions for industry, commerce and health care, voluntary and public sectors. & Lt; Span class = "NBResult" & gt; & Lt; / Span & gt; & Lt; Span class = "NBResult" & gt; Data transmission speed & lt; / Span & gt; & Lt; Span & gt; green fuels, the need for small business marketing, European bureaucracy and treatment & lt; / Span & gt; & Lt; Span class = "NBSearchTerm" & gt; & Lt; / Span & gt; & Lt; Period & gt; & Lt; / Span & gt; & Lt; Span class = "NBSearchTerm" & gt; Cancer & lt; / Span & gt; & Lt; Period & gt; All Universities are under investigation & Lt; / Span & gt; & Lt; / HtmlText>  

Update: This solution was updated after additional solution Has been in the comments:

Just hold the property of .text () of the parent selector.

  var myWords = " I      & Gt; Such as & lt; / span & gt;    words.  / * "I like the word" * / Alert ($ (myWords) .Find ("span"). Text ()); Warning ($ ("p.words duration"). Text ()); & Lt; P class = "word" & gt; & Lt; Period & gt; I & lt; / Span & gt; & Lt; Period & gt; & Lt; / Span & gt; & Lt; Period & gt; By way & lt; / Span & gt; & Lt; Period & gt; & Lt; / Span & gt; & Lt; Period & gt; By the word & lt; / Span & gt; & Lt; / P & gt;  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -