+ Reply to Thread
Results 1 to 8 of 8

getElementsByClassName Wildcard Character?

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    getElementsByClassName Wildcard Character?

    Hi All,

    I'm using getElementsByClassName but have various "PriceName" class names I want to get data from in the order they appear in the code. So I wanted to insert a wildcard character (*) as shown below:

    Please Login or Register  to view this content.
    I know I'm not allowed to use *. Any suggestions for how I could get around this? I've read a little about "Like" but have no idea how I would use it here.

    Cheers, Rob

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645
    Rob

    What type of elements are they?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: getElementsByClassName Wildcard Character?

    getElementsByClassName doesn't support wildcards, try using .querySelectorAll instead

  4. #4
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: getElementsByClassName Wildcard Character?

    Ok, thanks yudlugar, I'll give that a try. Norie, in response to your question, here is one of them (I simplified the original code I posted):

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: getElementsByClassName Wildcard Character?

    Why not loop through the table's td (and tr?) elements?

    By the way, I'm not seeing a class with the name 'PriceNameX' in that code.

  6. #6
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: getElementsByClassName Wildcard Character?

    Quote Originally Posted by Norie View Post
    Why not loop through the table's td (and tr?) elements?

    By the way, I'm not seeing a class with the name 'PriceNameX' in that code.
    Oh, you can do that? Would you mind pointing me in the right direction with looping through td and tr elements? Yes, rather than "odds ppodds Sportsbet" I just wrote "PriceName" in my original post. Not sure why I did that

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: getElementsByClassName Wildcard Character?

    If you can get the table it's pretty straightforward.

    You loop through all the tr or row elements, then for each tr you loop through the cells.

    Let's say you have a reference to the table, T, this code will put the data from it on a worksheet starting from A1.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: getElementsByClassName Wildcard Character?

    I think I'll be able to get the table. Thanks very much for your help Norie!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How do I use the wildcard character and the NOT function?
    By Bernie Deitrick in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  2. How do I use the wildcard character and the NOT function?
    By KDA in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  3. [SOLVED] How do I use the wildcard character and the NOT function?
    By KDA in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  4. [SOLVED] How do I use the wildcard character and the NOT function?
    By KDA in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-24-2005, 12:05 PM
  5. Wildcard character
    By agenda9533 in forum Excel General
    Replies: 1
    Last Post: 05-11-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1