Help with jQuery coding?

So I’m just messing around in Sublime, trying to code a sub-par webpage out of boredom. I’m trying to make a div disappear when clicking on it, but it won’t work. Can someone help?

Here’s the jQuery code:

$(document).ready(function() {
	$('div').click(function() {


<!DOCTYPE html>
		<title> HTML practice with Sublime </title>
		<link type='text/css' rel='stylesheet' href='css sublime practice 1.css' />
		<script type='text/javascript' src='jquery practice.js'> </script>
		<h1>insert something here</h1>
		<p>i am bored with nothing to do so i am coding a webpage whoopdee do</p>
				<th colspan=2>table header</th>
					<td>row 1, cell 1</td>
					<td>row 1, cell 2</td>
					<td>row 2, cell 1</td>
					<td>row 2, cell 2</td>

And finally, the CSS:

h1 {
	color: blue;
	font-family: Courier New;

p {
	color: purple;
	font-family: Courier New;
	font-weight: bold;

div {
	width: 50px;
	height: 50px;
	border: 3px solid green;
	color: green;
	font-family: Courier New;
	background-color: yellow;
	border-radius: 5px;

table {
	border: 2px solid red;
	border-radius: 3px;
	font-family: Courier New;
	color: red;
	background-color: purple;

Sorry if the answer is obvious, things seem to fly over my head sometimes.

Hi Jay,

First, you’re missing a link to jQuery. Add this before your currently existing <script> tag:

<script src=""></script>

Then, rename jquery practice.js to something without a space (it could be jquery-practice.js, if you like), or change the space in your <script> tag there to a %20. Browsers don’t understand spaces in filenames like that, so you have to use certain % numbers instead for special characters, spaces included :slight_smile:

1 Like

Ah, it worked! Thank you!!

1 Like