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

  • SEARCH
  • Home
  • 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 8610513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:08:56+00:00 2026-06-12T04:08:56+00:00

This is driving me insane. I am trying to select a DOM element by

  • 0

This is driving me insane. I am trying to select a DOM element by ID in jQuery and remove it. Despite my best efforts, jQuery keeps giving me Uncaught Error: Syntax error, unrecognized expression: #li-/media/photos/KObtu.jpg

But this id definitely does exist in my DOM. So I decided to cut jQuery out of the picture and use plain ol’ javascript. This worked beautifully, but I have no idea why.

function DeletePhoto() {
    //Remove a photo from the server when the delete button is clicked
    $("#personal-photo-list .delete").click( function() {
        var photoId = $(this).attr("id").split("-")[1];
        $.post("profile/DeletePhoto/", { "photo": photoId }, function(jsonObject){
            $("#li-" + photoId).remove(); //What I actually want to call. Does not work
            $("#li-/media/photos/KObtu.jpg").remove(); //I thought maybe using a variable was throwing things off.  This does not work either
            document.getElementById("li-/media/photos/KObtu.jpg").innerHTML="dsfsdfsdfsdf"; //The exact same id as the statements above. This command successfully replaces the text in the <li> tag
    });
});

}

In case anyone is curious, here is a snippet of the HTML:

<li id="li-/media/photos/KObtu.jpg">
                <img src="/media/photos/KObtu.jpg"> 
                <p> Uploaded on Sept. 23, 2012 | <a href="javascript:void(0)" id="a-/media/photos/KObtu.jpg" class="delete"> Delete </a> </p>
</li>

Thank you so much in advance.

  • 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-12T04:08:58+00:00Added an answer on June 12, 2026 at 4:08 am

    From the documentation:

    If you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes: \\.

    / is a meta-character, so you have to escape it.

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

Sidebar

Related Questions

This is driving me insane. I'm trying to INSERT a value into the following
This is driving me insane. I'm trying to change the panels when you click
This has been driving me insane for about the last hour. I'm trying to
This is driving me insane. I am trying to get a basic Report to
This is driving me insane. I am trying to grab an object in javascript
This is driving me farking insane. I'm trying to create a simple beginner app
This is driving me insane. The Maven failsafe plugin will not run on my
Any help most appreciated, this is driving me insane. I'm doing exactly what I
This is driving me absolutely insane. I know that, to change the formatting of
This one is driving me insane, and i can't figure out why it's throwing

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.