Pavel
Pavel

Reputation: 3

JQuery .load() function doesnt work

The code below doesn't load content of html page to div, only display alert. Can you tell what wrong with it, please?

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="jquery-2.1.1.min.js">
</script>

<script >
$( document ).ready(function() {

            $( "a" ).click(function( event ) {
                alert( "The link will no longer take you to jquery.com" );
                $( "#content" ).load( "registration.html" );
                event.preventDefault();
            });
        });
</script>
</head>

<body>
<a href="#">JQUERY</a>
<div id="#content">

</div>
</body>
</html>

Upvotes: 0

Views: 659

Answers (2)

Edan Feiles
Edan Feiles

Reputation: 465

change

<div id="#content">
</div>

to

<div id="content">
</div>

Upvotes: 2

Gelunox
Gelunox

Reputation: 792

Your div's ID is #content, change it to just content. (only in the html, NOT in the jQuery selector)

Upvotes: 4

Related Questions