When I use the following "jquery.event" line:
var newevent= jQuery.Event("keypress").which(40).keycode(40);
...I get the following error:
Uncaught TypeError: jQuery.Event(...).which is not a function
How can I prevent this error?
Further clarification:
When the two lines I use are:
var newevent= jQuery.Event("keypress").which(40).keycode(40);
$('#juris1 .selectpicker').trigger(newevent);
This code triggers the event (and opens a select box), but I get the error.
When I use the standard way from the API documentation, I no longer get an error, but the code does not trigger the keypress
var newevent = jQuery.Event("keypress", { keyCode: 40, which: 40 });