Hi, why is my #div not hiding when it's clicked, maybe placing it within a document.ready function wasn't needed ?

Recommended Answers

Try this:

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$((function(){
    $("#tags_hide").hide();
}));
</script>
</head>
<body>
<div id="tags_hide">If you click on the "Hide" button, I will disappear.</div>
<button id="hide">Hide</button>
<button id="show">Show</button>
</body> …
Jump to Post

Please provide your sample jQuery code.

Jump to Post

Oh, sorry... The jQuery code needed a minor change. The jsfiddle configuration also did not have the jQuery library loaded.

updated: http://jsfiddle.net/Lcx78/1/

Jump to Post

Take a look at this example.

http://jsfiddle.net/42yaE/8/

When working with anchor <a/> elements, keep in mind that they have a default behaviour which is to load some information. You need to prevent that …

Jump to Post

All 14 Replies

Try this:

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$((function(){
    $("#tags_hide").hide();
}));
</script>
</head>
<body>
<div id="tags_hide">If you click on the "Hide" button, I will disappear.</div>
<button id="hide">Hide</button>
<button id="show">Show</button>
</body>
</html>

Hope this helps

Please provide your sample jQuery code.

I did it's within the link, hiding. :)

Oh, sorry... The jQuery code needed a minor change. The jsfiddle configuration also did not have the jQuery library loaded.

updated: http://jsfiddle.net/Lcx78/1/

I made this into a string, thanks for the help I appeciate it :)

I wanted the words FadeIn to FadeIn the DivID#Apple, you can see the code here.

Take a look at this example.

http://jsfiddle.net/42yaE/8/

When working with anchor <a/> elements, keep in mind that they have a default behaviour which is to load some information. You need to prevent that loading from happening if you simply want them to initiate some process that is not related to redirecting/loading a new page.

I thought it had to do with FireFox NoScript extension because I found a post relating to the error message that you can change a setting within NoScript.

I never knew about events in jQuery do they work identical to events in Javascript ?

I never knew about events in jQuery do they work identical to events in Javascript ?

I'm not exactly sure what you mean, but the first thing you need to understand about jQuery is that its a JavaScript library, meaning that jQuery is simply JavaScript code, nothing more.

I've never seen event used in that manner with Javascript, yet jQuery is as you say, nothing more then Javascript.

Yes, the events are used in plain old javascript; it's the vehicle for making this happen in your javascript code. For example, onclick, onmouseover, etc... It's just written a different way.

JQuery's main purpose is for you to develop your code easier and quicker. Their slogan is "write less, do more"

I know how to use events in Javascript; the only thing being the syntax.

Ok, so is there any additional help needed on this thread or are you good at this point with regard to the jQuery example/div hiding/fadeIn, etc..?

I think I'm good at this point. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.