Code doesn't work on my local browser


#1


https://www.codecademy.com/en/courses/web-beginner-en-jtFIC/1/2?curriculum_id=50a3fad8c7a770b5fd0007a1


When I try the code from the above exercise outside of codeacademy it doesn't work. When I click on the car I get this below error

jquery-ui.min.js:5 Uncaught TypeError: e(...).find(...).andSelf is not a function
at e.(anonymous function).(anonymous function)._getHandle (http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js:5:17534)
.....


<!DOCTYPE html>
<html>
	<head>
		<title></title>
        <link rel='stylesheet' type='text/css' href='stylesheet.css'/>
		<script src='https://code.jquery.com/jquery-3.1.0.min.js'></script>
        <script type='text/javascript' src='script.js'></script>
        <script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js'></script>
	</head>
	<body>
        <div id="car">
            <div id="top"></div>
            <div id="bottom"></div>
            <div id="fwheel"></div>
            <div id="bwheel"></div>
        </div>   
	</body>
</html>

//the css
#top {
    position: relative;
    height: 50px;
    width: 50px;
    border-radius: 5px;
    background-color: #cc0000;
    left: 25px;
}
#bottom {
	position: relative;
	height:25px;
	width: 100px;
	background-color: #cc0000;
	border-top-left-radius: 5px;
	border-top-right-radius: 5px;
	top: -25px;
}
#fwheel {
	position: relative;
	height:20px;
	width:20px;
	border-radius: 100%;
	background-color: black;
	top: -35px;
	left: 5px;
}
#bwheel {
	position: relative;
	height:20px;
	width:20px;
	border-radius: 100%;
	background-color: black;
	top: -55px;
	left: 75px;
}

//the javascript
$(document).ready(function(){
    $('#car').draggable();
});


#2

Be sure to load jQuery before the custom script.


#3

Thanks mtf. I tried that and it didn't help.


#4

Try using a version 2 library, and the closest version to that of jQueryUI.


#5

Thanks you so much mtf. Using a different ui library version solved my problem.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.