2
* Copyright (C) 2013 Adnane Belmadiaf <daker@ubuntu.com>
3
* License granted by Canonical Limited
5
* This file is part of ubuntu-html5-ui-toolkit.
7
* This package is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as
9
* published by the Free Software Foundation; either version 3 of the
11
* (at your option) any later version.
13
* This package is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this program. If not, see
20
* <http://www.gnu.org/licenses/>.
26
Note the Ubuntu CSS style classes: <em>success</em>, <em>warning</em>, and <em>danger</em>
32
<button data-role="button" id="buttonID">text</button>
35
var button = UI.button("buttonID");
37
var Button = function (id) {
43
* Associate a function with the button's Click event
45
* @param {Function} callback - The function to execute on click
47
UI.button("buttonid").click(function(){
48
console.log("clicked");
51
click: function (callback) {
52
if ( ! document.getElementById(this.id)) {
53
throw "Invalid button ID: " + String(this.id);
55
new FastButton(document.getElementById(this.id), callback);
58
* Returns the DOM element associated with the id this widget is bind to.
60
* @return {DOMElement}
62
var mybutton = UI.button("buttonid").element();
65
return document.getElementById(this.id);