C# html列表框单击事件(html帮助器类)
我正在使用asp.NETMVC4.0,vs2010 我有一个列表框和文本区:C# html列表框单击事件(html帮助器类),c#,asp.net-mvc-4,html-helper,C#,Asp.net Mvc 4,Html Helper,我正在使用asp.NETMVC4.0,vs2010 我有一个列表框和文本区: <div class="editor-list-field"> @Html.ListBoxFor(model => model.TableColumn, new SelectList(Model.TableColumn), new { @class = "listofcolumn" , name="listofcolumn"}) @Html.ValidationMess
<div class="editor-list-field">
@Html.ListBoxFor(model => model.TableColumn, new SelectList(Model.TableColumn), new { @class = "listofcolumn" , name="listofcolumn"})
@Html.ValidationMessageFor(model => model.TableColumn)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Content)
</div>
<div class="editor-multiline-field">
@Html.TextAreaFor(model => model.Content, new { cols=60,@rows=10, @class = "textarea" name = "textarea"})
@Html.ValidationMessageFor(model => model.Content)
</div>
您可以使用jQuery和
您可以使用jQuery和
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js">
$(function() {
$('#listofcolumn').dblclick(function() { alert('clicked');
if ($(this).is(':selected')) {
var selectedId = $(this).val();
var selectedText = $(this).text();
alert(selectedText);
$('#textarea').val(selectedText);
}
});
});
</script>
$('textarea').on('dblclick', function () {
alert('hola');
});