Avatar of maqskywalker
maqskywalker
 asked on

hiding a html tag on page load with JavaScript or jQuery

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.
JavaScriptHTML

Avatar of undefined
Last Comment
maqskywalker

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Moussa Mokhtari

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
maqskywalker

ASKER
Thanks
Your help has saved me hundreds of hours of internet surfing.
fblack61