Page 1 of 1

How to create a button with javascript...

Posted: Tue Mar 18, 2014 3:33 pm
by Alex GG

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


How to create a button with javascript...

Posted: Tue Mar 18, 2014 6:09 pm
by Maryna Brodina

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/


How to create a button with javascript...

Posted: Tue Mar 18, 2014 6:21 pm
by Alex GG

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 ..

=)


How to create a button with javascript...

Posted: Tue Mar 18, 2014 7:48 pm
by Alex GG

Dont worry about this !

I ́ve managed to solve this...


How to create a button with javascript...

Posted: Tue Mar 18, 2014 8:08 pm
by Maryna Brodina

Thank you for update!