Solved

hiding a html tag on page load with JavaScript or jQuery

Posted on 2016-07-16
2
67 Views
Last Modified: 2016-07-16
I have this fiddle which contains html, css and jquery code.

http://jsfiddle.net/w71fywwx

In the HTML portion of my fiddle I have this code:


    <div id="Div1">
        <span id="Span1"></span>
        <div id="Div2">
        </div>
        <span id="Span2"></span>
        <div id="Div3">
        </div>
    </div>

Open in new window


I'm trying to hide the span tag with this id="Span1 on page load from completely being rendered in the browser.

If you run this fiddle in Google Chrome and look at the html rendered inside Div1 it looks like this:

running in chrome
I noticed the html for the span tag rendered in google chrome is this.

<span id=Span1" style="display: none;"></span>

My fiddle just hide its visibility but I actually want to keep the span tag from being completely rendered not just made invisible.  

So this span wasn't hidden. just some css was added to it.

Is there a way to use JavaScript or jQuery to completely hide this Span tag so it is not rendered in the web browser?
I don't want just the display:none tag added to it like my fiddle is currently doing.
0
Comment
Question by:maqskywalker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
Moussa Mokhtari earned 500 total points
ID: 41714841
@maqskywalker
remove it like this
$("#Span1").remove();
0
 
LVL 1

Author Closing Comment

by:maqskywalker
ID: 41714870
Thanks
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question