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 1079663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:54:18+00:00 2026-05-16T21:54:18+00:00

I’m trying to remove this element on success function, but it’s not doing it!!

  • 0

I’m trying to remove this element on success function, but it’s not doing it!!

jQuery file:

 $(function () {
        //More Button
        $('.more').live("click", function () {
            var ID = $(this).attr("id");
            if (ID) {
                $("#more" + ID).html('<img src="moreajax.gif" />');
                $.ajax({
                    type: "POST",
                    url: "ajax_more.php",
                    data: "lastmsg=" + ID,
                    cache: false,
                    success: function (html) {
                        $("ul.statuses").append(html);
                      // my problem is here
                        $("#more" + ID).remove();
                    }
                });
            }
            else {
                $(".morebox").html('The End');
            }
            return false;
        });
    });

This is the html file:
This is the button that’s clicked to retrieve more results!

echo'<div id="more'. $dateTime.'" class="morebox">
    <a href="#" class="more" id="'.$dateTime.'">more</a>';
  • 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-05-16T21:54:19+00:00Added an answer on May 16, 2026 at 9:54 pm

    If your id has a space in it, that’s your problem. The space is valid in an id attribute, but it messes up the CSS selector you’re using here (because it’s not escaped correctly):

    $("#more" + ID).remove();
    

    For instance, with the ID you quoted in a comment on another answer, that will end up being:

    $("#more2010-09-20 12:53:43").remove();
    

    …which is an invalid selector (I’m pretty sure; at the very least, it isn’t the selector you’re looking for).

    The easiest thing is probably to ensure that your $dateTime variable’s value doesn’t have any spaces in it. For good measure, I’d avoid the colons (:) as well, but I’m probably just being paranoid (no, I’m not, see below).

    So for instance, you can change your PHP code that outputs these to use str_replace and look something like this (I’m not a PHP guy, apologies if there are minor syntax issues, but you get the gist):

    $baseId = str_replace(':', '', str_replace(' ', '_', $dateTime));
    echo'<div id="more'. $baseId.'" class="morebox"><a href="#" class="more" id="'.$baseId.'">more</a>';
    

    Details on the CSS selectors thing: There are lots of valid id values that you can’t use in CSS selectors unless you escape certain characters. Very nearly anything is valid in an id, but the ID you use with a CSS selector has to use a subset of that or be escaped correctly:

    In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier “B&W?” may be written as “B\&W\?” or “B\26 W\3F”.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.