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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:08:53+00:00 2026-05-29T08:08:53+00:00

In less words: I have multiple JavaScript sections located at different places in document.

  • 0

In less words:

I have multiple JavaScript sections located at different places in document. Some of them are loaded and evaluated with AJAX:

<script id="js5533" type="text/javascript">
  javascript and jquery stuff (lots)
</script>
<script id="js7711" type="text/javascript">
  javascript and jquery stuff (lots)
</script>

As you can see I ID every section.

My goal is to get rid of specific section by clicking on button.

$('.somebutton').click(function() {
  $('#js7711').remove();
});

Of course this function removes only element from the document and all JavaScript functions in section js7711 are still working.

I don’t want to manually remove every function and variable from the section by doing things like a(); a = 0;

Are there any less coding solutions?

Thanks.

P.S. jQuery is also used.

  • 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-29T08:08:53+00:00Added an answer on May 29, 2026 at 8:08 am

    Found a lazy workaround for this.

    First of all: reason for getting rid of previous JS code is – to run a new code (similar or same with the old one) without reloading page.

    The solution is:
    To forget about previously loaded code and execute your new code with jQuery.globalEval(js); where js is a var containing your actual new JS code.

    jQuery just creates another sequence with your new code which does not interfere with the old one excluding live events (solved with event.stopPropagation())

    Works for me perfectly.

    Like someone said: you cannot make a browser forget about the JS which was already executed.

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

Sidebar

Related Questions

How much less efficient would it be to store some fields as a BigDecimal
I have 3 tables Person, Names, and Notes. Each person has multiple name and
I have set of value in float (always less than 0). Which I want
I have a big table in my database with a lot of words from
I have a PrintDocument that has several pages. One page in that document must
I'm having some issues with maintaining scroll bar locations. The Background I have a
I have this code: HTML <div class=box_meteo> <div class=box_meteo_pulsanti> <a href=javascript:void(0); class=box_meteo_pulsante id=meteoButton1>Link</a> </div>
I have a question, less pertaining to actual implementation more towards how it works.
I have an Ajax call to create an image gallery. There is a combo
I have a text file that contains more or less paragraphs. The text is

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.