Trigger shortcut keys with click

Trigger shortcut keys with click

Hi everyone,

I am trying to simulate a shortcut keypress using javascript. What do I need?
We have an application that calls a phone number. That action is triggered with Ctrl+1 and the phone number needs to be highlighted. I want to do it by just clicking an icon on the webscreen.

I have an Icon inside a container and an onclick extended property for the container like this:
document.getElementById('" + Employee_UserMobilePhone.Id + "').select();
$(function() {
    var e = $.Event('keypress');
    e.which = 67;
    e.keyCode = 67;
    e.ctrlKey = true;

This is not working. Any ideas?


what is not working?
I suggest to make it a function btw, instead of putting everything in the onclick, so you can console.log it a little bit better.

do you get javascript-errors?
is the event even called.
do you bubble/propgate the event ?