- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have a javascript function in which I want to set the href of a sprite button. Nothing seems to work. I have tried
- document.getElementById('button').href
- document.getElementById('button').src
with jQuery via setAttribute..
Anyone who can tell me what I should do to set the href of a sprite button?
Thanks
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it is the "Sprite Button" from App Designer, just register a click handler on it.
In the Interactivity pane in App Designer find your button and in the right column choose "Custom Script". Then click the "Edit Script" button - that'll add a handler for you and you can just put whatever code you want in there.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What type of element is 'button'? The HTML href attribute can only be added to a HTML <a> tag.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it is the "Sprite Button" from App Designer, just register a click handler on it.
In the Interactivity pane in App Designer find your button and in the right column choose "Custom Script". Then click the "Edit Script" button - that'll add a handler for you and you can just put whatever code you want in there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where are you attempting to go ? To another file? To a #section on the page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have registered a click handler for it.
document.getElementById('button').onclick = (function(value){ code... });
This did the trick
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page