Javascript replicate existing button click in link

error77 used Ask the Experts™
Hi all,

I am using JQuery Mobile DateBox plugin and it works fine.

It has a button that opens a popup which shows the calendar.

I need to create a link that will do the same thing as it's button.

Does anyone have any idea on how to do this please?

Here is a link to the demo page

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Line 384 of

		var openbutton = $('<b>Test<\/b>')
			.click(function (e) {
				if ( !o.disabled ) {;					
			.css({'vertical-align': 'middle', 'float': 'right'});

Open in new window

Removed: .buttonMarkup({icon: 'grid', iconpos: 'notext', corners:true, shadow:true}) from after .appendTo(focusedEl).

That section inserts the button / icon. Put whatever you want in the $('<b>...<\/b>') part, but it must be a tag (not plain text).


So, how could I create a link that opens the calendar (does the same as that button) please?

The link can only ever be contained in the <div> that is created when .datebox() is run against an input. To change the way the link/button/icon displays inside the <div> that is generated, change line 384 to read
var openbutton = $('<a href=\'#\'>link you want to show<\/a>')

Open in new window

then remove
.buttonMarkup({icon: 'grid', iconpos: 'notext', corners:true, shadow:true})

Open in new window

from line...392.
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


Sorry, for not explaining myself properly, what I mean is. Is it possible (without changing the JS file), to add my own extra link in the page that would open that popup too?

You can, but you would need to create a section of javascript anyway. The link's called function references parent objects, meaning the link needs to be contained in the <div> tag that the JS creates. You would need to create a listener, and then create your own link.

Your link MUST BE contained in the <div> that is created. You cannot have a link elsewhere on the page.


Thanks a lot.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial