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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:05:42+00:00 2026-05-27T14:05:42+00:00

<div id=msg_container> <span> Is this helpful ? </span> <span class=feedback> <a title=like> Yes </a>

  • 0
<div id="msg_container">
  <span> Is this helpful ? </span>
  <span class="feedback"> 
     <a title="like"> Yes </a> 
     <a title="dislike"> No </a> 
  </span>
</div>

// jQuery Script
$('.feedback a').live('click', function() {
   var reference = $(this).parent().parent();
   $.post("URL", $("FORM").serialize(),
        function(data){
    // posted successfully and following will be executed
    reference.empty();
            reference.add('<span> You have given feedback </span>');

   }, "json");       
});

The process would be:

  1. User will be asked ‘Is this helpful? Yes No’
  2. Upon clicking either ‘Yes’ or ‘No’, .post method will be executed
  3. After posting to server successfully,
  4. I want the DOM element id=”msg_container” to change entire content to a normal span or paragraph with the sentence ‘You have given your feedback’ so that each user can only give one feedback.

The problem:

  1. Once the div “msg_container” it’s emptied, the .add() didn’t work.
  2. Even without emptying the “msg_container’, the .add() still didn’t work.
  3. I read the documentation, the .add() doesn’t seem to work with reference object just like I did above.
  4. I have to assign the reference to variable as such var reference = $(this).parent(); Otherwise, after executing $.post, the $(this) will lose its original ‘this’ reference.

Any idea how to solve this? I can accept alternative solutions as long as my requirement is fulfilled.

  • 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-27T14:05:43+00:00Added an answer on May 27, 2026 at 2:05 pm

    You could use append()

    reference.append('<span> You have given feedback </span>');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following div structure, but this structure is changing <div class=rt-container> <div
The JS script: function ShowUploadingAnimation() { $('#info_msg').html(<div style=\padding-top: 15px; height: 50px;\ align=\center\><img id=\uploading-img\ /></div>);
$('div.box').html(hello) puts the word hello inside all my div's of class 'box'. They all
this div to cover up the viewport works perfect on IE 7, 8, FF,
struct Div { int i; int j; }; class A { public: A(); Div&
This code $(#loading).ajaxStart(function() { alert(start); $(this).show(); }); in my mark-up <div style=text-align:center;><img id=loading src=../images/common/loading.gif
I am using jQuery to load the search results from a php class when
I've been trying to figure out how to work this jQuery Form plugin to
i have the following scenary: <div class=maindiv> <div class=msg>some text</div> ... <div class=msg>some other
I want to append some simple data in a div like: $('#msg').append('Some text'); In

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.