Altay Mazlum
Altay Mazlum

Reputation: 442

I can't seem to apply Jquery to my Microsoft Visual Studio

Can anyone suggest me a solution please? I've been trying half an hour to get jQuery ready and working for my Visual Studio but it does not work. I can't really be specific because i also don't know why.

<script>
    $(document).ready(function () {
        $("button").click(function () {
            $("#square").animate({ left: '500px' }, slow);
        });
    });
</script>

<style>
    #square{
        border: solid; border-color: aqua; border-width: 1px; background-color: skyblue; width: 125px; height: 125px; text-align:center;
    }
</style>

<body>
<div id="square">Focus on me!</div>
<div> <button>Click me</button> </div>

Upvotes: 0

Views: 217

Answers (2)

Rajesh Biswas
Rajesh Biswas

Reputation: 242

You have to add jquery to your page. You can add jQuery in two ways :

  1. Download the jQuery library from jQuery.com

  2. Include jQuery from a CDN, like Google

The jQuery library is a single JavaScript file, and you reference it with the HTML tag :

<head>
<script src="jquery-1.11.3.min.js"></script>
</head>

And for CDN :

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

then write your code :

$(document).ready(function(){

   alert("Hello there!")

});

Upvotes: 1

Mivaweb
Mivaweb

Reputation: 5722

Add this piece of code above the closing body tag.

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

Now you have successfully added jQuery!

Upvotes: 1

Related Questions