How to add jQuery to JSfiddle
Asked Answered
A

4

61

The interface of JSfiddle has changed and i can't see any option to add jQuery, and set it onLoad as it was Before..

So can someone help me how to activate it.

And thank you for help.

Annelieseannelise answered 14/4, 2016 at 10:36 Comment(2)
JSfiddle changed its interface so, in nowadays, no answer is working!Lipson
@PeterKrauss: It works exactly as described below for me.Angulo
C
84

Alternatively to Velimir Tchatchevsky's Answer you can click the Javascript Settings button (top right left of Javascript pane).

enter image description here

You can select jQuery, and other extensions and frameworks, from the Frameworks & Extensions drop down.

Also, depending on the library selected there are also some other extensions to that library. An example below of jQuery 1.7.2, you can also include jQuery UI, jQuery Mobile etc.

enter image description here


In regards to Velimir Tchatchevsky's answer, the External Resources section on the left is more for importing other files / libraries that JSFiddle does not have.

For example, you could import libraries like FontAwesome or Datatables.js, or your own hosted CSS / JS files.

Chrotoem answered 14/4, 2016 at 11:2 Comment(1)
As @mry shows in their answer - the settings button is now in the top left of the JS panel.Chrotoem
C
7

At the left side there is an "external resources" button that you can click and fill in the url of the jquery source

Clarenceclarenceux answered 14/4, 2016 at 10:37 Comment(2)
Thanks so now it doesn't set it it selfAnnelieseannelise
"jquery" not works, no autocomplete... please show a concrete example to illustrate... Ah, now working fine, code.jquery.com/jquery-1.11.3.jsLipson
C
3

Had the same question. using ImClarky's answer figured it out in updated interface. Adding steps in updated interface. hope these help someone looking for same in future

  1. Click on Javascript menu in javascript pane and select jQuery from Frameworks & Extensions menu

enter image description here

  1. Add your code using jQuery !!

enter image description here

Carrero answered 12/1, 2018 at 18:11 Comment(0)
S
0

Add the following to the top of the html block:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>

Example:


function code()
{
console.log('change');
console.log($('#select').val());
$('#copySelect').html($('#select').val());
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>

<select id="select" onchange="code()">
<option value="Hi">Hi</option>
<option value="Bye">Bye</option>
</select>
<span id="copySelect">
Hi
</span>
Savell answered 20/7, 2023 at 11:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.