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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:25:12+00:00 2026-06-14T14:25:12+00:00

I have several elements on the page. Something like: <div id=el1><div id=el2><span id=el3>1</span><span id=el4>2</span></div><span

  • 0

I have several elements on the page. Something like:

<div id="el1"><div id="el2"><span id="el3">1</span><span id="el4">2</span></div><span id="el5">3</span></div>

I need to disable/enable any of them, using their ids.

<input type="radio" name="do" onclick="disable(document.getElementById('el4'));">        
<input type="radio" name="do" onclick="enable(document.getElementById('el4'));">

What should be in disable() and enable() functions to really disable elements?

By “disable” I mean make it invisible for user, inaccessible by “id” and be restorable by “enable()” function.

Is it possible to turn elements on/off? Entirely, I mean.

  • 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-14T14:25:14+00:00Added an answer on June 14, 2026 at 2:25 pm
    function  addEl4(){
       var elem = document.getElementById('el2'); 
       var newElem = document.createElement('div');
       newElem.setAttribute('id', 'el4');
       newElem.innerHTML = 2;
       elem.appendChild(newElem);
    };
    
    function  disable(elem){
       var container = document.getElementById('el2'); 
       container.removeChild(elem);
    };
    

    If you are talking in terms of removing the element from the page completely.
    Then you can use the .removeChild() method..
    Then need to append it to the div you are talking about..

    Check Fiddle

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

Sidebar

Related Questions

Lets assume I have several <span class='remove-type'> elements on a page. In jQuery document.ready
I have several HTML blocks on a page set up like: <p class=something> <a
I have several elements on the html page, I call them through javascript like
http://jsfiddle.net/EGjc9/ I have several <button> elements on a page, and I need to associate
I have a page which has several <canvas> elements. I am passing the canvas
I have a TabControl and under it I have several elements like TreeView and
I have several div elements for charts. Yslow is saying to reduce DOM elements.
I have an asp.net page with several list boxes. I would like to include
I have several 'select' elements on the page. When I choose some of options,
I have several elements in my web page generated by JavaScript. Here's an example

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.