开发者

Why is this simple jQueryUI code not working?

开发者 https://www.devze.com 2023-03-29 11:03 出处:网络
Here\'s the literal HTML markup I have: <!DOCTYPE html> <html> <head> 开发者_运维技巧<title>Register</title>

Here's the literal HTML markup I have:

<!DOCTYPE html>

<html>

<head>

开发者_运维技巧    <title>Register</title>

    <link href="/Content/Site.css" rel="stylesheet" type="text/css" />

    <script src="/Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>

</head>



<body>





<h2>Register</h2>



<script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>

<script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>

<script src="/Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>

<link rel="Stylesheet" href="../../Content/jquery-ui-1.8.16.custom.css" />



<script type="text/javascript">

    $(document).ready(function() {

        $('.date-selector').datepicker();

    }

</script>



<form action="/account/register" method="post">    <fieldset>

        <legend>UserModel</legend>
<div class="editor-label">

            <label for="DateOfBirth">Fecha de Nacimiento</label>

        </div>

        <div class="editor-field">

            <input class="date-selector" data-val="true" data-val-required="Debe escribir su fecha de nacimiento" id="DateOfBirth" name="DateOfBirth" type="text" value="1/1/0001 12:00:00 AM" />;

            <span class="field-validation-valid" data-valmsg-for="DateOfBirth" data-valmsg-replace="true"></span>

        </div>

Notice that the class date-selector is properly set, and also the javascript is properly hooking the event up. (I think).

How can I debug what's going wrong? Why doesn't the datepicker control pop up when I click on the date of birth input textbox?


You're missing a closing ); at the end of your $(document).ready() handler:

$(document).ready(function() {

    $('.date-selector').datepicker();

});

For future reference, a good tool for checking your JavaScript before even running it is JSLint.

0

精彩评论

暂无评论...
验证码 换一张
取 消