Opened 9 years ago
Closed 9 years ago
#14489 closed bug (notabug)
ReferenceError: $ is not defined
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Why won't my jQuery code work? This is the error from Mozilla firefox: ReferenceError: $ is not defined. The code for jQuery:
$(document).ready(function() {
$('#button').click(function() {
var toAdd = $('.checkListItem').val(); $(".list").append('<div class="removeText"><div class="Remove">Remove</div><textarea class="item">' + toAdd + '</textarea></div>');
});
}); $(document).on('click', '.Remove', function() {
$(this).parents('.removeText').remove();
});
Code for HTML:
<!DOCTYPE html> <html>
<head>
<title>To Do</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/> <script type="text/javascript" src="ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="script.js"></script> </head> <body>
<h2>To Do</h2> <form name="checkListForm"> <div data-role="fieldcontain">
<textarea class="checkListItem"></textarea>
</div> </form> <div id="button">Add!</div> <br/> <div class="list"></div>
</body>
</html>
Code for CSS(Not needed really):
.Remove {
background: red; color: orange; width: 65px; height: 22.5px; text-align: center; border-radius: 12.5px;
} .item {
height: 75px; width: 250px; background: lightblue; text-align: center; border: 1px black solid; margin-top: 2px; margin-left: 2px; margin-right: 2px; margin-bottom: 2px; color: green; display: block;
} h2 {
font-family:arial;
}
form {
display: inline-block;
}
#button{
display: inline-block; height:20px;
width:70px; background-color:#cc0000; font-family:arial; font-weight:bold; color:#ffffff; border-radius: 5px; text-align:center; margin-top:2px;
}
.list {
font-family:garamond; color:#cc0000;
}
I thank you for any response given to me.....
And I don't know what version of jQuery I am using.
Please ask for help on a forum.