Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8933557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:34:08+00:00 2026-06-15T09:34:08+00:00

Without going into specifics why I’m doing this… (it should be encoded to begin

  • 0

Without going into specifics why I’m doing this… (it should be encoded to begin with, but it’s not for reasons outside my control)

Say I have a bit of HTML that looks like this

<tr data-path="files/kissjake's files"">...</tr> so the actual data-path is files/kissjake's files"

How do I go about selecting that <tr> by its data path?

The best I can currently do is when I bring the variables into JS and do any manipulation, I URLEncode it so that I’m always working with the encoded version. jQuery seems smart enough to determine the data-path properly so I’m not worried about that.

The problem is on one step of the code I need to read from a data-path of another location, and then compare them.

Actually selecting this <tr> is what’s confusing me.

Here is my coffeescript

oldPriority = $("tr[data-path='#{path}']").attr('data-priority')

If I interpolate the URLEncoded version of the path, it doesn’t find the TR. And I can’t URLDecode it because then jQuery breaks as there are multiple ‘ and ” conflicting in the path.

I need some way to select any <tr> that matches a particular data-attribute, even if its not encoded in the html to begin with

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:34:08+00:00Added an answer on June 15, 2026 at 9:34 am

    First, did you mean to have the extra " in there? You will have to escape that, as it’s not valid HTML.

    <tr data-path="files/kissjake's files&quot;">...</tr>
    

    To select it, you need to escape inside the selector. Here’s an example of how that would look:

    $("tr[data-path='files/kissjake\\'s files\"']")
    

    Explanation:

    \\' is used to escape the ' inside the CSS selector. Since ' is inside other single quotes, it must be escaped at the CSS level. The reason there are two slashes ‘\` is we must escape a slash so that it makes it into the selector string.

    Simpler example: 'John\\'s' yields the string John\'s.

    \" is used to escape the double quote which is contained inside the other double quotes. This one is being escaped on the JS level (not the CSS level), so only one slash is used because we don’t need a slash to actually be inside the string contents.

    Simpler example: 'Hello \"World\"' yields the string Hello "World".


    Update

    Since you don’t have control over how the HTML is output, and you are doomed to deal with invalid HTML, that means the extra double quote should be ignored. So you can instead do:

    $("tr[data-path='files/kissjake\\'s files']")
    

    Just the \\' part to deal with the single quote. The extra double quote should be handled by the browser’s lenient HTML parser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Without going into whether this is a good or bad idea: Is it possible
I have a LARGE datatable (500k-1m rows), without going into detail this is a
Not getting into too many specifics, this is a high level question. I've always
Without going into specifics and breaking NDA... If a developer preview of OSX shows
Without going into detail about what I'm trying to achieve, is it possible (and
I'm most likely going about this the wrong way, but I was wondering if
Is it possible to check the memory leak without going into the code. I
I'm sorry this question is going to be a bit vague because I'm not
Is it okay to get a read-only collection from an aggregate without going through
I was helping someone with their homework and ran into this strange issue. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.