1

我正在尝试在上面的脚本中引用文本框数据,请问有什么想法吗?

<script type="text/javascript">
    $(document).ready(function () {
        $('??').datepicker();       
    });
</script>

<div class="editor-label">&nbsp;&nbsp;
    Date:
    @Html.TextBoxFor(model => model.RTDATE)&nbsp;&nbsp;&nbsp;
</div>
4

2 回答 2

1

@Html.TextBoxFor(model => model.RTDATE)将呈现一个带有 id 和 name 的输入元素RTDATE

使用 jQuery,您可以使用以下方法来处理它:

$("#RTDATE").datepicker();
于 2012-05-09T20:23:27.317 回答
0

By default asp.net mvc will generate an input with the same name as your model property. So in your case above you can do

$("#RTDATE").datepicker();

Here's a quick (although not perfectly formatted) list of the helpers and what they output in html in the default cases.

于 2012-05-09T20:20:17.203 回答