このコードが機能しないのはなぜですか?警告メッセージが表示されないのはなぜですか? 問題はどこだ?
$('.msg_txt).keypress(function (e) {
if (e.which == 13) {
$("#sendform").submit(function () {
$.post($(this).attr("action"),
$(this).serialize(),
function (data) {
alert("ok, this work");
});
e.preventDefault();
});
}
});
私のcshtmlファイル..
@using (Html.BeginForm("Send", "Mycontroller", FormMethod.Post, new { id = "sendform" }))
{
<textarea id="TextArea1" class="msg_txt" name="poruka" cols="20" rows="2"></textarea>
<input id="Submit1" type="submit" value="Send" />
}