0

Here i am using a jquery datepicker from this sample http://dev.jtsage.com/jQM-DateBox2. It is working fine but the problem is after clicking the submit button if there is any mandatory field validation error,the next time when i click the textbox jquery datepicker is not working means the script is not loading after submit click.it is throwing the error in firebug console like

TypeError: $(...).datebox is not a function
$('#txtstartdate').datebox('open');

Here is my code

$(document).ready(function () {
    $('#txtstartdate').live('click', function () {
        $('#txtstartdate').datebox('open');
        $("#txtstartdate").datebox("option", {
            mode: "calbox",
            highDatesAlt: ["2011-11-09", "2011-11-10"],
            highDates: ["2011-11-02", "2011-11-03"],
            pickPageOAHighButtonTheme: "b"
        });
    });
 });

and

@Html.TextBoxFor(m => m.StartDate, new { @name = "mydate", @id = "txtstartdate",  style = "height:20px; font-size:10px;", data_role = "datebox", data_options = "{\"mode\":\"calbox\",\"useButton\": false}" })

Any suggestion?

4

1 回答 1

1

由于萤火虫错误表明浏览器找不到脚本中使用的函数,您能否确保在提交调用后日期框的依赖项可用。
还尝试将依赖项与视图本身一起发送,以便在客户端每次呈现视图页面时,它都会在其中保存这些 js 文件。

于 2013-01-03T12:16:38.533 回答