How to have the ctrl button pressed on page load

Hi

I am currently using a Jquery selectable to allow users to select block.
It allows them to drag and select but i would also like to allow users to select individual blocks and this is achievable by having the ctrl key pressed when the page loads.
EasyToHelpAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hans LangerCommented:
You can detect they key pressed on almost any mouse event:

List of Mouse Event in JQuery

Every listener function will receive an "eventObject" where you can identify if control is pressed or not,
example:
$('#elementId').mouseup(function(eventObject){
    var isCtrlPressed = eventObject.ctrlKey;
    alert(isCtrlPressed )   // true or false whether ctrl is pressed or not 
  });

Open in new window

0
MrunalCommented:
hi,
have you done everything same as:
https://jqueryui.com/selectable/#display-grid

can you share your code?
0
EasyToHelpAuthor Commented:
Hi Mrunal

Yes that is what i had used,
Now if you press the control key the user is able to select  items 1 and 12.

I am using this on a mobile device so the user does not have a ctrl key that they can press,  how would it be possible for me to achieve this on a mobile device,is it possible to get the keypressed event to occur when the page is loaded.

Regards
0
MrunalCommented:
ohh. so you are using this in Mobile development.

In that case you can add your own logic, just like normally any Android - Gallary have.

Press one of the box/thumbnail so that it will get selected and start clicking others to get those also be selected.

Another way is you can show some checkbox in any corner of that box and select which you want.

Hope this helps you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.