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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:55:12+00:00 2026-05-16T00:55:12+00:00

I’ve a page in an ASP.net site where i’ve multiple content placeholders, script tags

  • 0

I’ve a page in an ASP.net site where i’ve multiple content placeholders, script tags with JavaScript functions and others elements. I’m hiding all content holders and other html elements using JavaScript except a div which i want to display. But i get the other scripts running in that page. How can i remove them?

Any ideas?

Edit1

Lets consider i’ve a following page

<html>
<head>

    <script type="text/javascript">
        alert("unnecessary script")
    </script>

</head>
<body>

    <script type="text/javascript">
        alert("another one")
    </script>

    <div id="div1">
        Div 1</div>
    <div id="div2">
        Div 2</div>
    <div id="div3">
        Div 3</div>

    <script type="text/javascript">
        alert("one more")
    </script>

</body>
</html>

I’m loading this page in an iFrame in another page where in the frame OnLoad() i call HideUnneededHTML() which hides everything except div2. How can i remove the unnecessary Javascript too before it gets loaded?

  • 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-16T00:55:13+00:00Added an answer on May 16, 2026 at 12:55 am

    One thing you might try is to reassign the unnecessary function(s) to a new function that does nothing. Afterall, Javascript functions are first class objects so they can be assigned a new value. This will not remove the lines from your page, but it will render the functions useless. If you want to switch them off temporarily, assign their value to another variable and then reassign them. You can always switch them back to the value saved in the other variable.

    <script type="text/javascript">
        function myAmazingFunction(){
           alert("Does Something");
        }
    </script>
    

    later…

    <script type="text/javascript">
        myAmazingFunction = function(){};
    
        //Now, call it... 
        myAmazingFunction();
    </script>
    

    This is safe because it means that any other code that is calling these functions will not cause errors – they just wont do anything.

    Give it a go and let me know how you get on.

    Edit:
    I have confirmed that this approach should work. Here I switch the function from Does Something, to Does Something Else and back again.

    <script type="text/javascript">
        function myAmazingFunction() {
            alert("Does Something");
        }
        myAmazingFunction();
        var temp = myAmazingFunction;
        myAmazingFunction = function() { alert("Does Something Else"); };
        myAmazingFunction();
        myAmazingFunction = temp;
        myAmazingFunction();
    </script>
    

    results in 3 alert boxes in this order:

    Does Something
    Does Something Else
    Does Something
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display

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.