Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$ is not defined in jsfiddle

Suppose I have the following html:

<div id="test1">hi</div>
<a href="#" onclick="showDiv()">click here</a>

and the javascript:

function showDiv() {
    $("#test1").hide();
}

When I try it on jsfiddle, it returns:

$ is not defined

Did I miss some setting in jsFiddle?

Thanks.

like image 782
Kintarō Avatar asked Mar 18 '13 01:03

Kintarō


People also ask

What is JSFiddle used for?

JSFiddle is an online IDE service and online community for testing and showcasing user-created and collaborational HTML, CSS and JavaScript code snippets, known as 'fiddles'. It allows for simulated AJAX calls.

What is fork JSFiddle?

Fork will split out an existing fiddle into a new one, starting with version 0.

How do I find my JSFiddle?

Click on your profile -> dashbord : http://jsfiddle.net/user/dashboard/ then select your saved code. So simple.


2 Answers

That suggests that you have not selected one of the jQuery libraries from the left hand side of the screen.

JSFiddle

like image 120
Drew Noakes Avatar answered Oct 13 '22 19:10

Drew Noakes


These answers are old and for anyone looking for an updated version the dropdown menu is now located on the gear next to the word Javascript at the top right of your javascript window in jsfiddle.

like image 24
Kyle Wilson Avatar answered Oct 13 '22 21:10

Kyle Wilson