1

I've been trying to retrieve the text from the following div:

<div class="col-md-7 order-md-1">
                                <strong>Name: </strong> Adept Rider<br>
                                <strong>Type: </strong> Craftable<br>
                                <strong>Location: </strong> Summerset<br>
                                <strong>Traits needed to craft: </strong> 3<br>
                                <strong>Requires DLC: </strong> Summerset<br>
                                <br><strong>Obtainable items: </strong>
                                <ul>
                                    <li>Weapons</li>
                                    <li>Light Armor</li>
                                    <li>Jewels</li>
                                    <li>Heavy Armor</li>
                                    <li>Medium Armor</li>
                                </ul>
                                <br>
                                <br>
</div>

I want a const location to be a String that prints out 'Summerset'. I tried the following approach:

const location = $('strong:contains("Location:")').text();
console.log(location); // prints: Location: 

The following approach prints nothing:

const location = $('strong:contains("Location:")').next().text();
console.log(location); // prints nothing, but expect ' Summerset'

Do you folks have any tips on how to approach this? I think I load the HTML in the correct way since I do get 'Location: ' printed out without the use of the next() call.

Frank
  • 99
  • 3
  • 14

0 Answers0