Javascript - How to create a keypress event?
<p>I've looked on the internet for this and all I can find are depreciated functions so before posting please check to make sure that the code you suggest isn't depreciated.</p>

<p>I've found this and tried it:
<a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent</a></p>

<pre><code>$(document).ready(function () {
    var x = new KeyboardEvent("FormatCode", deprectiatedArgument);
});
</code></pre>

<p>But after further inspection the <code>KeyboardEventInit</code> is depreciated.</p>

<p>I would like to create an event on pres of the CTRL + K keys.</p>