MVC 3,DropDownList OnSelect

时间:2011-09-19 14:03:47

标签: asp.net-mvc-3 event-handling drop-down-menu html-helper

我有一个功能下拉列表。我还有两个与下拉列表相关的文本框。我希望在下拉列表更改并初始化时,使用所选对象的数据填充文本框。这可能吗?

1 个答案:

答案 0 :(得分:2)

是的,你可以使用这样的jquery函数:

<form>
  <input class="target" type="text" value="Field 1" />
  <select class="target">
    <option value="option1" selected="selected">Option 1</option>
    <option value="option2">Option 2</option>
  </select>
</form>
<div id="other">
  Trigger the handler
</div>

$('.target').change(function() {
  alert('Handler for .change() called.');
});
相关问题