How to get the text after a span using jquery (multiple span)

ginko

I have this html code and I was wondering how to get the text after span I tried using different methods and none worked.

<div id="nowplaying">
    <div class="art200-left fixed-height">
        <img class="art200" alt="Album Art" src="https://www.animenfo.com/radio/albumart/PCCA-02442.jpg" id="nowplaying_albumart" albumart class="albumart" hotkey="alt+=" />
        <div class="float-container">
            <div class="row">
                <div class="span6"> <span class="text-semibold">Artist:</span>  <span data-search-artist>Ueto Aya</span>
                    <br/> <span class="text-semibold">Title:</span> Namida no Niji
                    <br/> <span class="text-semibold">Album:</span>  <span data-search-album>Namida no Niji/SAVE ME</span> (2007)
                    <br/> <span class="text-semibold">Album Type:</span> Theme Song Single
                    <br/> <span class="text-semibold">Series:</span>  <span class="seriestag">Hotelier</span>
                    <br/> <span class="text-semibold">Genre(s):</span> Jdorama
                    <br/>
                </div>
                <div class="span6"> <span class="text-semibold">Duration:</span>  <span id="np_timer" rel="214">3:34</span> / <span id="np_time" rel="265">4:25</span>
                    <br/>	<span class="text-semibold">Rating:</span> 5.95 / 10 (234 rates)
                    <br/>

I'm trying to get the text Namida no Niji, Theme Song Single and other text after a span.

doug65536
var elemBefore = $('span.text-semibold').filter(function() {
        return $(this).text().match(/Title:/);
    }),
    relatives = elemBefore.parent().contents(),
    index = relatives.index(elemBefore);
var after = relatives.eq(index+1).text();

elemBefore is assigned the element relative to which you want the next node. relatives is assigned a selector of all of the nodes with the same parent including itself. index is assigned the index of elemBefore within relatives. after grabs the text your test case is looking for.

The key to this is the contents jquery method. It returns all of the child nodes (including text nodes). The eq method is used to get the node after by index.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get the text with in span tag using jquery?

From Dev

How to get the value with span text by using jquery

From Dev

How to get the actual text from a span element enclosed within multiple span tags, using Selenium Webdriver with Java

From Dev

How to get a span from a div by span text in jquery

From Dev

How to change text in span using Jquery

From Dev

How to get the inner span id using JQuery

From Dev

How to get the inner span id using JQuery

From Dev

Get a text in the span, using protractor

From Dev

How add a span after innerhtml text inside a div using jQuery or javascript?

From Dev

how to use jquery to dynamically build a .text node that contains multiple <span>

From Dev

How can i get text between <span> </span>using python splinter lib

From Dev

How can i get text between <span> </span>using python splinter lib

From Dev

How to add text into span after document.createElement("span");?

From Dev

How to encapsule text before and after <span> into another <span>?

From Dev

How to read text in Span tag when multiple span in Selenium

From Dev

jquery - how to find a span containing text withing another span

From Dev

Using jQuery to set value after SPAN element

From Dev

replace text string with span using jQuery

From Dev

Switch span text using JQuery in a table

From Dev

Unable to change Span text using JQuery

From Dev

Cannot change span text using jquery

From Dev

Changing text after a span

From Dev

jQuery How to get span value when clicked on other span

From Dev

CSS How to hide text after a span

From Dev

Get text using selenium PhantomJS inside Span

From Dev

How do I append span to span present in html using jquery?

From Dev

How to get data betwen <span ...</span> using preg match all?

From Dev

how to get a data from a span and transfer it to an other span using javaScript

From Dev

Jquery Adding text to a span

Related Related

  1. 1

    How to get the text with in span tag using jquery?

  2. 2

    How to get the value with span text by using jquery

  3. 3

    How to get the actual text from a span element enclosed within multiple span tags, using Selenium Webdriver with Java

  4. 4

    How to get a span from a div by span text in jquery

  5. 5

    How to change text in span using Jquery

  6. 6

    How to get the inner span id using JQuery

  7. 7

    How to get the inner span id using JQuery

  8. 8

    Get a text in the span, using protractor

  9. 9

    How add a span after innerhtml text inside a div using jQuery or javascript?

  10. 10

    how to use jquery to dynamically build a .text node that contains multiple <span>

  11. 11

    How can i get text between <span> </span>using python splinter lib

  12. 12

    How can i get text between <span> </span>using python splinter lib

  13. 13

    How to add text into span after document.createElement("span");?

  14. 14

    How to encapsule text before and after <span> into another <span>?

  15. 15

    How to read text in Span tag when multiple span in Selenium

  16. 16

    jquery - how to find a span containing text withing another span

  17. 17

    Using jQuery to set value after SPAN element

  18. 18

    replace text string with span using jQuery

  19. 19

    Switch span text using JQuery in a table

  20. 20

    Unable to change Span text using JQuery

  21. 21

    Cannot change span text using jquery

  22. 22

    Changing text after a span

  23. 23

    jQuery How to get span value when clicked on other span

  24. 24

    CSS How to hide text after a span

  25. 25

    Get text using selenium PhantomJS inside Span

  26. 26

    How do I append span to span present in html using jquery?

  27. 27

    How to get data betwen <span ...</span> using preg match all?

  28. 28

    how to get a data from a span and transfer it to an other span using javaScript

  29. 29

    Jquery Adding text to a span

HotTag

Archive