“cara mengirim event event ke input field jQuery” Kode Jawaban

jQuery on enter tombol ditekan

//jQuery detect user pressing enter
$(document).on('keypress',function(e) {
    if(e.which == 13) {
        alert('User pressed Enter!');
    }
});
Grepper

Masukkan acara di jQuery

$('#textbox').keypress(function(event){
	var keycode = (event.keyCode ? event.keyCode : event.which);
	if(keycode == '13'){
		alert('You pressed a "enter" key in textbox');
	}
});
Ranish

cara mengirim event event ke input field jQuery

var e = jQuery.Event("keydown");
e.which = 13; //choose the one you want
e.keyCode = 13;
$("#theInputToTest").trigger(e);
Mobile Star

Teks Filed Press Enter Event JQuery

$('#someTextBox').keypress(function(event){
  var keycode = (event.keyCode ? event.keyCode : event.which);
  if(keycode == '13'){
    alert('You pressed a "enter" key in textbox');  
  }
});
Ahsan Awan

Jawaban yang mirip dengan “cara mengirim event event ke input field jQuery”

Pertanyaan yang mirip dengan “cara mengirim event event ke input field jQuery”

Lebih banyak jawaban terkait untuk “cara mengirim event event ke input field jQuery” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya