Timeline for How to create a button with onclick with JavaScript?
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 4, 2013 at 12:41 | vote | accept | luciansvnc | ||
| Aug 30, 2013 at 5:34 | review | Suggested edits | |||
| Aug 30, 2013 at 5:39 | |||||
| Aug 29, 2013 at 11:32 | review | First posts | |||
| Aug 29, 2013 at 11:34 | |||||
| Aug 29, 2013 at 11:26 | comment | added | bobince |
Caveats: 1. default button type is submit (except in older IE due to bugs), so because you don't return false from the event handler, if the button is in a form, the form will be submitted afterwards. Also setting value on the button does nothing (except in older IE due to bugs); if you want to add text to the button then append a text node to its content, or otherwise use an <input type="button"> where value does correctly affect the text. But otherwise yeah... no obvious problem with calling the handler.
|
|
| Aug 29, 2013 at 11:24 | answer | added | deostroll | timeline score: 1 | |
| Aug 29, 2013 at 11:21 | comment | added | Briskstar Technologies | It seems already working fine... Check it out..jsfiddle.net/3VXrF | |
| Aug 29, 2013 at 11:18 | comment | added | Mitya | There is nothing obviously wrong with your code. Any JS errors? | |
| Aug 29, 2013 at 11:18 | comment | added | Kos | The approach is OK, see developer.mozilla.org/pl/docs/DOM/element.onclick Can you create a demo of your problem on jsfiddle? | |
| Aug 29, 2013 at 11:14 | history | edited | putvande | CC BY-SA 3.0 |
added 4 characters in body; edited title
|
| Aug 29, 2013 at 11:12 | history | asked | luciansvnc | CC BY-SA 3.0 |