javascript button click

I'm transferring this fiddle to a regular html page.

The fiddle works just fine.

This is my code for my html page but when i click on the buttons on my html page they don't work.

<!DOCTYPE html>
<html xmlns="">

    <script src=""></script>

    <style type="text/css">

        .content { display:none; }
        .displayed { display:block; }


    <script type="text/javascript">

        $('#buttons button').click(function () {
            var div = $(this).data('div');



<div id="buttons">
   <button data-div="#div1">Button 1</button>
   <button data-div="#div2">Button 2</button>
   <button data-div="#div3">Button 3</button>

<div class="content" id="div1">This is div 1</div>
<div class="content" id="div2">This is div 2</div>
<div class="content" id="div3">This is div 3</div>


Open in new window

My html page buttons should work just like the fiddle above.

Anyone know what i'm doing wrong?
Who is Participating?
Randy DownsConnect With a Mentor OWNERCommented:
You are missing this:
See my page.

<script type="text/javascript">//<![CDATA[ 
$('#buttons button').click(function() {
    var div = $(this).data('div');


Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.