keypress イベントをセレクターの結果にアタッチする必要があります。
var inputElement = $(this).parent().find("input[myAttributeID]");
変数の要素から関数としてアタッチする方法を知っていますが、それを呼び出す方法さえ知りません
ありがとう
keypress イベントをセレクターの結果にアタッチする必要があります。
var inputElement = $(this).parent().find("input[myAttributeID]");
変数の要素から関数としてアタッチする方法を知っていますが、それを呼び出す方法さえ知りません
ありがとう
inputElement.on("keypress", function(oEvent) { });
//or
var inputElement = $(this).parent()
.find("input[myAttributeID]")
.on
(
"keypress",
function(oEvent)
{
if (oEvent.keyCode == 13)
{ /* whatever happens */ }
}
);
keypress イベントが発生すると、関数が呼び出されます。コードから呼び出してテストするには:
inputElement.trigger("keypress");