- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I need to trigger a button click event from my index_user_scripts.js.
I'm using App Framework.
Thanks in advance.
Marco
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try something like
$( "#mybutton" ).trigger( "click" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If using the design view, just open the interactivity pane and you'll see your button listed there. Click on the target on the right and choose "Custom Script...". That'll add an entry for you to that index_user_scripts.js
But, essentially, it's doing something very similar to what SithLord suggested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
thanks for replies. I have to get the same effect of pushing a button, not only execute the code event inside the "click".
For example in c#, vb ecc it´s enough simple by calling the subroutine button_click and the framework also switches the focus on the pushed button.
I hope this clarifies my question.
Marco
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
using jQuery:
$("#mybutton").click() or $("#mybutton").trigger("click");
See the jQuery docs for 'click' and 'trigger'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you consult the jQuery docs for those routines? You can also test them in the console.
http://api.jquery.com/trigger/
The code I gave you will not run as written. You'll need to change the CSS selector, minimally.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
maybe I found what I need :
$( '#button1' ).trigger("click");
$( '#button1' ).addClass("pressed");
The effect is to run the code inside the click button, and set the "focus" on the related button.
Sorry but I'm newbie at HTML5, CSS, javascript dev and for a "VisualStudio developer" like me is difficult to explain how I want to get.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page