0

I have a beginner's problem with jquery UI script not loading. Basically I am trying to make some checkboxes as buttons but this is not working when I declared jquery UI script like this:

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

<input type="checkbox" id="check" /><label for="check">Toggle</label>

<div id="format">
  <input type="checkbox" id="check1" /><label for="check1">B</label>
  <input type="checkbox" id="check2" /><label for="check2">I</label>
  <input type="checkbox" id="check3" /><label for="check3">U</label>
</div>

http://jsfiddle.net/ftraian/cu8mS

1
  • In jsfiddle you're not really supposed to add <script> elements within the html pane as well as including others in the Frameworks & Extensions options - you were mixing the two. If you select jquery-ui from the Frameworks & Extensions options at the left it works: jsfiddle.net/cu8mS/2 In a real webpage include both jquery and jquery ui as per Tieson T.'s answer. Commented Oct 12, 2013 at 6:34

2 Answers 2

1

See your modified Fiddle, I added jQuery and jQuery ui css http://jsfiddle.net/cu8mS/1/:

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

1

jQuery UI doesn't include the core jQuery library. Add a reference to it before your jQuery UI reference.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

EDIT: It's worth noting that jsFiddle doesn't normally allow <script> tags in the HTML section. It definitely is not executing the CDN request. If you check the UI checkbox and run the fiddle, the button styles kick in...

2 Comments

Does not JSfiddle loads it automatically when set in the left menubar in "Frameworks and extensions" (just asking, not sure) ?
@vinaut It does, but the code the OP shows here does not include the jQuery reference. Basically, the jsFiddle doesn't seem to match what he's showing here...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.