question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Getting attribute from listItem

See original GitHub issue

I want to scrape a table with a bunch of cells, some of which have links in them. By using the options below I can get an array containing the text of the links.

{
  links: {
    listItem: "table tr td a"
  }
}		

However I need to get the href-attribute the links. How would I go about doing that?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
IonicaBizaucommented, Mar 2, 2017

Ah, I see!

Can you try this:

{
    links: {
        listItem: "table tr td a"
      , data: {
            url: {
                // By not passing a selector, I assume it will use the current item
                attr: "href"
            }
        }
    }
}
0reactions
IonicaBizaucommented, Mar 2, 2017

Phew! 😁 Cool! You’re welcome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get attribute value from a selected item in a list - Stack Overflow
How can I get data-id property from the selected li ? I have tried this code in Jquery: this.$list = this.find("ul").first(); this.$list.on(" ...
Read more >
Read attributes from listbox listitem - MSDN - Microsoft
User-446880360 posted. Hi,. I add attribute to list item with: userid.Attributes.Add("style", "color:red"). Now I want to use this attribute ...
Read more >
<li>: The List Item element - HTML: HyperText Markup Language
This integer attribute indicates the current ordinal value of the list item as defined by the <ol> element. The only allowed value for...
Read more >
[Solved] get custom attribute of listBox items - CodeProject
When adding ListItems dynamically and setting attributes that the attribute tags are not retained during postback.
Read more >
Lists in HTML documents
This attribute sets the style of a list item. Currently available values are intended for visual user agents. Possible values are described below...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found