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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:25:41+00:00 2026-06-05T16:25:41+00:00

Quick question. If i am trying to clear multiple divs with the same class

  • 0

Quick question. If i am trying to clear multiple divs with the same class all at once is there a jQuery short cut to doing this? I tried $('.clearit').empty(); and that does not seem to work at all (none on the divs with that class are being cleared). Could I be doing this wrong or does this just not work? Let me know, I tried $('.clearit').html('');. Also I have this along with other code that runs after it in jquery and everything else runs as it should. I debugged the code and it seems to run the function and move on with no errors but the div content is not cleared. Here is a sample of the divs:

<center><div class="clearit" id="container2">Loading the player ...</div></center>
</li>
<li>
<center><div class="clearit" id="container3">Loading the player ...</div></center>
</li>
<li>  
<center><div class="clearit" id="container4">Loading the player ...</div></center>

and here is the code for one of the handlers. Please note everything in there works except for the $('.clearit').html('');.

$('.thumbNav li a').click(function(){
    $('.clearit').html('');


var str = $(this).html();
var pattern = /[0-9]+/g;
var matches = str.match(pattern);
var myInteger = parseInt(matches);
//variable for player
var container = "container"+myInteger;
var what = 'skill'+myInteger;
var location = "https://aliahealthcare.com/videofetcher.php?id=skill"+myInteger;
player(container,what,location);  

$('#'+what).attr('selected', 'selected');   


    });

To anyone still helping me, THANKS SO MUCH! also i have modified the site so you no longer need a login to get in so you can see it in action for yourself. Please use the code above as reference in finding the javascript. (It is all located in vid.php) Thanks

https://aliahealthcare.com/vid.php

Also i just discovered something interesting. The li’s above are part of a ul with in id of slider. When i do $('#slider').html(''); or $('#slider').empty(); It works but it clears all the div thus the players that load inside those divs dont load. All i need to do is just clear the players so you cant have multipul players running at the same time.

  • 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-05T16:25:44+00:00Added an answer on June 5, 2026 at 4:25 pm

    Please see working demo here: http://jsfiddle.net/TxR8K/

    updated from your given code: http://jsfiddle.net/TxR8K/1/

    by the way your unordered list tag i.e. ul is missing in the sample 🙂

    Update further after discussion with OP – we also found out – the player is actually not part of the html in the div, hence he/she knows what needs to be done and clears his./her way for further fix 🙂

    This should do the trick

       $('.clearit').html('');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

quick question. I am trying to use either javascript, jquery, or php to make
quick question. im trying to animate a few things with jquery and although its
I have a quick question for you all. I'm trying to convert over some
Hey all. Quick question here. I'm trying to keep the camera centered on the
Quick question, I'm trying to pass a value to a variable and then run
Quick question hopefully someone can help out here. I'm trying to copy and paste
Quick question! Does putting a clear element INSIDE a floated div do anything? Like:
quick question, is it secure to use the jQuery.post function in jQuery to pass
quick question. I am trying to get C++ nailed down, and today I spent
Quick question.... We're trying to make a decision on a dms here and Alfresco

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.