Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Simulate double click on single click

Simulate double click on single click

Simulate double click on single click

I am using a calendar system (pinpoint) on a website however the website users are no understanding the process of the calendar.

A user selects a date and is then presented with a list of times for that date.

The user can only select one time, however pinpoint requires them to click a start and end time. As the start and end time is the same time, they effectively have to double click their chosen time.

Despite adding descriptive text highlighting this, the users are getting muddled and fail to double click their time.

I have tried to force a double click using javascript, however it is not working

CODE --> js

<script type='text/javascript'>
$('.DOPBSPCalendar-hour').click(function() {

The hours popup looks like this

CODE --> php

<div class="DOPBSPCalendar-hours" id="2_2017-01_hours" style="display: block;">
   <div class="DOPBSPCalendar-hour dopbsp-available dopbsp-selected" id="2_17:30">    
      <div class="dopbsp-bind-top">
         <div class="dopbsp-hour">&nbsp;</div>
      <div class="dopbsp-bind-middle dopbsp-group0">        
         <div class="dopbsp-hour">17:30 - 18:15</div>        
         <div class="dopbsp-price">&pound;5</div>        
         <div class="dopbsp-available">18 available</div>        
         <div class="dopbsp-info" id="2_17:30_info"></div>    
      <div class="dopbsp-bind-bottom">
         <div class="dopbsp-hour">&nbsp;</div>

And here is a video showing the double click requirement


Have I missed something?


RE: Simulate double click on single click


According to my experience, just calling the .dblclick() method only forwards the calls to an event handler you assigned earlier.

To properly simulate an event you have to instantiate it and dispatch it :

CODE --> JavaScript

document.getElementsByClassName('DOPBSPCalendar-hour')[0].dispatchEvent(new MouseEvent('dblclick', {'bubbles': true})) 

No idea how portable is. ( Only tried on FireFox. ) No idea how to achieve the same with jQuery. With the bubbles option also works if the event listener is bound to a parent of the dispatcher element.


RE: Simulate double click on single click

Thanks feherke, getting closer, I found this fiddle doing something similar by instantiating and dispatching it.


Can't quite seem to get it to double click itself

RE: Simulate double click on single click


Yepp, essentially the same. Mozilla Developer Network calls it "the old-fashioned way".

Sorry, at this point I can not imagine what exactly is in the code. For further hints on debugging this I would need to see that code running. sad


RE: Simulate double click on single click


But I see no code there that would handle a dblclick event. surprise

Anyway, I would say it is just matter of configuration. Somewhere in the middle of HTML there is the JavaScript call that initializes the calendar :

CODE --> ( fragment, lines 159..163 )

159 <script type="text/JavaScript">
160     jQuery(document).ready(function(){
161         jQuery("#DOPBSPCalendar2").DOPBSPCalendar({/*...*/});
162     });
163 </script> 
In that huge line there is a fragment where you can change multipleSelect to false :

CODE --> ( fragment, line 161 )

// before
// after
That seems to instruct the script to do what you want.


RE: Simulate double click on single click

Aha, initially I contacted the plugin authors who said that due to the way the plugin is coded it is not possible to facilitate one click without much modification. Shouldn't have taken their word for it. Thanks Feherke, with your help I managed to find the file and line deep in their file structure that added this setting.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close