Alex GG
Posts: 0
Joined: Thu Nov 14, 2013 11:11 pm

How to create a button with javascript...

Hello,

I need to create a button (programatically) with Javascrip that when pressed takes me to an URL.. (I need to mention that an HTML component cant be added to the screen, because of the plugin design)

I tried this inside a custom JS of the plugin

Image

but got lots of errors.

What else should I do to have the button working?

Regards

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to create a button with javascript...

Hello!

Code looks correct. Seems to be the problem is with something else. By the way in jqm usually links (tag < a ) are used instead button. See http://api.jquerymobile.com/button/. Regarding adding event on click take a look here http://api.jquery.com/on/

Alex GG
Posts: 0
Joined: Thu Nov 14, 2013 11:11 pm

How to create a button with javascript...

Image

Hello Maryna,

The plugin uses the above code to create the button, and when clicked takes to a link (evenUrl);

because iphone doesn ́t have a back button, I had to use the window.open(eventUrl, 'parent');

So what I need is to create a button that when clicked performs the window.open function...

Hope I had explained what I want to do ..

=)

Alex GG
Posts: 0
Joined: Thu Nov 14, 2013 11:11 pm

How to create a button with javascript...

Dont worry about this !

I ́ve managed to solve this...

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to create a button with javascript...

Thank you for update!

Return to “Issues”