javascript - How to trigger enter after changing input field -


i wondering how change value of something, take 15 example, , entering straight after manually. looked on things "trigger" confused me.

<input class="paging_input" data-se="trade-inventory-input-page" type="text"> 

you want trigger change value of input , simulate enter key press.

let's have in html file:

<input id="someid" type="text" /> 

and should write in js file:

function simulateenterpress(element) {     var e = $.event("keypress"); // create keypress event     e.which = 13; // set pressed key "enter"     element.trigger(e); // trigger event }  function doaction() {     var inputelement = $("#someid"); // input element     inputelement.val(/* somevalue */); // set value of input     simulateenterpress(inputelement); } 

after enter key keypress event triggered , processed keypress event handler.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -