It might be a stupid problem, but I am very new to jQuery. I am trying to create a button that on-click will pop-up a login dialog. Somehow the form is shown instead of being created as a dialog. Below is my code:
<head>
<script src="js/jquery-ui-1.8.21.custom.min.js"></script>
<script>
$(function() {
$('#login').dialog({
autoOpen: false,
title: 'Login',
height: 300,
width: 350,
modal: true
});
$('#open').click(function() {
$('#login_form').dialog('open');
return false;
});
});
</script>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div id="login">
<form class="caption" action="Login.php" method="post">
<p>E-mail: <br><input type="text" name="email" maxlength="255" /></p>
<p>Password:</p> <br><input type="password" name="pwd" /></p>
<p><input type="submit" value="Login" /></p>
</form>
</div>
<button id="open">Click</button>
</body>
Any idea what I have done wrong? Thank you very much!
Alex W had it above:
From https://developers.google.com/speed/libraries/devguide#jqueryUI
In addition, you’re trying to
openthe#login_formelement, rather than the#loginelement. You need to use the same jQuery set. See the modified code below.