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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:39:10+00:00 2026-06-06T08:39:10+00:00

I have quite a complex piece of code (JQuery and HTML5 Web SQL) that

  • 0

I have quite a complex piece of code (JQuery and HTML5 Web SQL) that removes info from a database. However, whilst the database removal works fine I want to make the info disappear from view in the meantime (it wont go until the page refreshes and the database is queried again).

I’m pretty sure its just a matter of getting the selectors right

Currently I have

$('.remove_event').live('click', function() {
    //TRIGGERS SQL REMOVE
    mbffdb.webdb.deleteevent($(this).attr('id')),
    //MAKES INFO DISSAPPEAR
    $(this).attr('id').addClass('displaynone');
});//END CLICK

The info is cotained in a div that is given a dynamic id
: $(this).attr('id') (the ID is used in the SQL statement to remove).

If anyone can help me that would be really awesome!

  • 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-06T08:39:13+00:00Added an answer on June 6, 2026 at 8:39 am

    Problem is, you add a class… to a string.
    Follow me:

    $(this) 
    

    is an element

    $(this).attr("id") 
    

    is the value of it’s attribute “id”, i.e. a string so you can’t add a class to it.

    By the way, do you want to add an id or a class? it’s not clear. If you want to add an id, use .attr("id","mynewid"). If you want to add a class, use $(this).addClass("class")


    Edit: you may have been misled by JQuery’s chainability, i.e. many functions operating on a JQUery element or set of elements return another element or set of elements.

    For example:

    $("div.mydiv").parent().next().find("p").removeClass("otherclass");
                  ^        ^      ^         ^
    

    In every call (^) the functions return other elements so you can attach another function to operate on those elements, yieling more elements and so on.
    But this is not true for some of the functions like:

    .val() .text() .html()
    

    that return “pure” values, not elements, so there’s no sense in using, after them, functions like addClass() which still operate con elements.

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

Sidebar

Related Questions

I have quite a large and complex table in a MySQL database that would
I have a quite complex multi-join TSQL SELECT query that runs for about 8
I have a script that works great. It is quite complex and does numerous
I have quite big document in html format that generated from Microsoft Word. It
I have quite a lot of C++ legacy code modules from my colleagues, unfortunately
I have a quite complex form that presents an option to run a script
I have been playing around with a quite complex SQL Statement for a few
I have a database that have quite a bit relational user information that would
I know that the question I have is quite complex, and I really hope
We currently have a quite complex business application that contains a huge lot of

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.