Subversion Repositories Sites.obs-saisons.fr

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
40 aurelien 1
 
2
<ul class="UIAPIPlugin-toc">
3
<li><a href="#overview">Overview</a></li>
4
<li><a href="#options">Options</a></li>
5
<li><a href="#events">Events</a></li>
6
<li><a href="#methods">Methods</a></li>
7
<li><a href="#theming">Theming</a></li>
8
</ul>
9
<div class="UIAPIPlugin">
10
  <h1>jQuery UI Button</h1>
11
  <div id="overview">
12
    <h2 class="top-header">Overview</h2>
13
    <div id="overview-main">
14
        <p>Button enhances standard form elements like button, input of type submit or reset or anchors to themable buttons with appropiate mouseover and active styles.</p>
15
<p>In addition to basic push buttons, radio buttons and checkboxes (inputs of type radio and checkbox) can be converted to buttons: Their associated label is styled to appear as the button, while the underlying input is updated on click.</p>
16
<p>In order to group radio buttons, Button also provides an additional widget-method, called Buttonset. Its used by selecting a container element (which contains the radio buttons) and calling buttonset(). Buttonset will also provide visual grouping, and therefore should be used whenever you have a group of buttons. It works by selecting all descendents and applying button() to them. You can enable and disable a buttonset, which will enable and disable all contained buttons. Destroying a buttonset also calls the button's destroy method.</p>
17
<p>When using an input of type button, submit or reset, support is limited to plain text labels with no icons.</p>
18
    </div>
19
    <div id="overview-dependencies">
20
        <h3>Dependencies</h3>
21
        <ul>
22
<li>UI Core</li>
23
<li>UI Widget</li>
24
</ul>
25
    </div>
26
    <div id="overview-example">
27
        <h3>Example</h3>
28
        <div id="overview-example" class="example">
29
<ul><li><a href="#demo"><span>Demo</span></a></li><li><a href="#source"><span>View Source</span></a></li></ul>
30
<p><div id="demo" class="tabs-container" rel="300">
31
A simple jQuery UI Button.<br />
32
</p>
33
<pre>$(&quot;button&quot;).button();
34
</pre>
35
<p></div><div id="source" class="tabs-container">
36
</p>
37
<pre>&lt;!DOCTYPE html&gt;
38
&lt;html&gt;
39
&lt;head&gt;
40
  &lt;link href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
41
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
42
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
43
 
44
  &lt;script&gt;
45
  $(document).ready(function() {
46
    $(&quot;button&quot;).button();
47
  });
48
  &lt;/script&gt;
49
&lt;/head&gt;
50
&lt;body style="font-size:62.5%;"&gt;
51
 
52
&lt;button&gt;Button label&lt;/button&gt;
53
 
54
&lt;/body&gt;
55
&lt;/html&gt;
56
</pre>
57
<p></div>
58
</p><p></div>
59
<div id="overview-example" class="example">
60
<ul><li><a href="#demo"><span>Demo</span></a></li><li><a href="#source"><span>View Source</span></a></li></ul>
61
<div id="demo" class="tabs-container" rel="300">
62
A simple jQuery UI Button.<br />
63
</p>
64
<pre>$(&quot;#radio1&quot;).buttonset();
65
</pre>
66
<p></div><div id="source" class="tabs-container">
67
</p>
68
<pre>&lt;!DOCTYPE html&gt;
69
&lt;html&gt;
70
&lt;head&gt;
71
  &lt;link href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
72
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
73
  &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
74
 
75
  &lt;script&gt;
76
  $(document).ready(function() {
77
    $(&quot;#radio1&quot;).buttonset();
78
  });
79
  &lt;/script&gt;
80
&lt;/head&gt;
81
&lt;body style="font-size:62.5%;"&gt;
82
 
83
&lt;div id=&quot;radio1&quot;&gt;
84
	&lt;input type=&quot;radio&quot; id=&quot;radio1&quot; name=&quot;radio&quot; /&gt;&lt;label for=&quot;radio1&quot;&gt;Choice 1&lt;/label&gt;
85
	&lt;input type=&quot;radio&quot; id=&quot;radio2&quot; name=&quot;radio&quot; checked=&quot;checked&quot; /&gt;&lt;label for=&quot;radio2&quot;&gt;Choice 2&lt;/label&gt;
86
	&lt;input type=&quot;radio&quot; id=&quot;radio3&quot; name=&quot;radio&quot; /&gt;&lt;label for=&quot;radio3&quot;&gt;Choice 3&lt;/label&gt;
87
&lt;/div&gt;
88
 
89
&lt;/body&gt;
90
&lt;/html&gt;
91
</pre>
92
<p></div>
93
</p><p></div>
94
    </div>
95
  </div>
96
  <div id="options">
97
    <h2 class="top-header">Options</h2>
98
    <ul class="options-list">
99
 
100
<li class="option" id="option-disabled">
101
  <div class="option-header">
102
    <h3 class="option-name"><a href="#option-disabled">disabled</a></h3>
103
    <dl>
104
      <dt class="option-type-label">Type:</dt>
105
        <dd class="option-type">Boolean</dd>
106
 
107
      <dt class="option-default-label">Default:</dt>
108
        <dd class="option-default">false</dd>
109
 
110
    </dl>
111
  </div>
112
  <div class="option-description">
113
    <p>Disables (true) or enables (false) the button. Can be set when initialising (first creating) the button.</p>
114
  </div>
115
  <div class="option-examples">
116
    <h4>Code examples</h4>
117
    <dl class="option-examples-list">
118
 
119
<dt>
120
  Initialize a button with the <code>disabled</code> option specified.
121
</dt>
122
<dd>
123
<pre><code>$( ".selector" ).button({ disabled: true });</code></pre>
124
</dd>
125
 
126
 
127
<dt>
128
  Get or set the <code>disabled</code> option, after init.
129
</dt>
130
<dd>
131
<pre><code>//getter
132
var disabled = $( ".selector" ).button( "option", "disabled" );
133
//setter
134
$( ".selector" ).button( "option", "disabled", true );</code></pre>
135
</dd>
136
 
137
    </dl>
138
  </div>
139
</li>
140
 
141
 
142
<li class="option" id="option-text">
143
  <div class="option-header">
144
    <h3 class="option-name"><a href="#option-text">text</a></h3>
145
    <dl>
146
      <dt class="option-type-label">Type:</dt>
147
        <dd class="option-type">Boolean</dd>
148
 
149
      <dt class="option-default-label">Default:</dt>
150
        <dd class="option-default">true</dd>
151
 
152
    </dl>
153
  </div>
154
  <div class="option-description">
155
    <p>Whether to show any text - when set to false (display no text), icons (see icons option) must be enabled, otherwise it'll be ignored.</p>
156
  </div>
157
  <div class="option-examples">
158
    <h4>Code examples</h4>
159
    <dl class="option-examples-list">
160
 
161
<dt>
162
  Initialize a button with the <code>text</code> option specified.
163
</dt>
164
<dd>
165
<pre><code>$( ".selector" ).button({ text: false });</code></pre>
166
</dd>
167
 
168
 
169
<dt>
170
  Get or set the <code>text</code> option, after init.
171
</dt>
172
<dd>
173
<pre><code>//getter
174
var text = $( ".selector" ).button( "option", "text" );
175
//setter
176
$( ".selector" ).button( "option", "text", false );</code></pre>
177
</dd>
178
 
179
    </dl>
180
  </div>
181
</li>
182
 
183
 
184
<li class="option" id="option-icons">
185
  <div class="option-header">
186
    <h3 class="option-name"><a href="#option-icons">icons</a></h3>
187
    <dl>
188
      <dt class="option-type-label">Type:</dt>
189
        <dd class="option-type">Options</dd>
190
 
191
      <dt class="option-default-label">Default:</dt>
192
        <dd class="option-default">{ primary: null, secondary: null }</dd>
193
 
194
    </dl>
195
  </div>
196
  <div class="option-description">
197
    <p>Icons to display, with or without text (see text option). The primary icon is displayed by default on the left of the label text, the secondary by default is on the right. Value for the primary and secondary properties must be a classname (String), eg. "ui-icon-gear". For using only one icon: icons: {primary:'ui-icon-locked'}. For using two icons: icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}</p>
198
  </div>
199
  <div class="option-examples">
200
    <h4>Code examples</h4>
201
    <dl class="option-examples-list">
202
 
203
<dt>
204
  Initialize a button with the <code>icons</code> option specified.
205
</dt>
206
<dd>
207
<pre><code>$( ".selector" ).button({ icons: {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'} });</code></pre>
208
</dd>
209
 
210
 
211
<dt>
212
  Get or set the <code>icons</code> option, after init.
213
</dt>
214
<dd>
215
<pre><code>//getter
216
var icons = $( ".selector" ).button( "option", "icons" );
217
//setter
218
$( ".selector" ).button( "option", "icons", {primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'} );</code></pre>
219
</dd>
220
 
221
    </dl>
222
  </div>
223
</li>
224
 
225
 
226
<li class="option" id="option-label">
227
  <div class="option-header">
228
    <h3 class="option-name"><a href="#option-label">label</a></h3>
229
    <dl>
230
      <dt class="option-type-label">Type:</dt>
231
        <dd class="option-type">String</dd>
232
 
233
      <dt class="option-default-label">Default:</dt>
234
        <dd class="option-default">HTML content of the button, or value attribute</dd>
235
 
236
    </dl>
237
  </div>
238
  <div class="option-description">
239
    <p>Text to show on the button. When not specified (null), the element's html content is used, or its value attribute when it's an input element of type submit or reset; or the html content of the associated label element if its an input of type radio or checkbox</p>
240
  </div>
241
  <div class="option-examples">
242
    <h4>Code examples</h4>
243
    <dl class="option-examples-list">
244
 
245
<dt>
246
  Initialize a button with the <code>label</code> option specified.
247
</dt>
248
<dd>
249
<pre><code>$( ".selector" ).button({ label: "custom label" });</code></pre>
250
</dd>
251
 
252
 
253
<dt>
254
  Get or set the <code>label</code> option, after init.
255
</dt>
256
<dd>
257
<pre><code>//getter
258
var label = $( ".selector" ).button( "option", "label" );
259
//setter
260
</p>
261
$( ".selector" ).button( "option", "label", "custom label" );</code></pre>
262
</dd>
263
 
264
    </dl>
265
  </div>
266
</li>
267
 
268
    </ul>
269
  </div>
270
  <div id="events">
271
    <h2 class="top-header">Events</h2>
272
    <ul class="events-list">
273
      <p>There are no events for this plugin.</p>
274
    </ul>
275
  </div>
276
  <div id="methods">
277
    <h2 class="top-header">Methods</h2>
278
    <ul class="methods-list">
279
 
280
<li class="method" id="method-destroy">
281
  <div class="method-header">
282
    <h3 class="method-name"><a href="#method-destroy">destroy</a></h3>
283
    <dl>
284
      <dt class="method-signature-label">Signature:</dt>
285
        <dd class="method-signature">.button( "destroy"
286
 
287
 
288
 
289
 
290
 
291
 
292
 
293
)</dd>
294
    </dl>
295
  </div>
296
  <div class="method-description">
297
    <p>Remove the button functionality completely. This will return the element back to its pre-init state.</p>
298
  </div>
299
</li>
300
 
301
<p>
302
<li class="method" id="method-disable">
303
  <div class="method-header">
304
    <h3 class="method-name"><a href="#method-disable">disable</a></h3>
305
    <dl>
306
      <dt class="method-signature-label">Signature:</dt>
307
        <dd class="method-signature">.button( "disable"
308
 
309
 
310
 
311
 
312
 
313
 
314
 
315
)</dd>
316
    </dl>
317
  </div>
318
  <div class="method-description">
319
    <p>Disable the button.</p>
320
  </div>
321
</li>
322
 
323
 
324
<li class="method" id="method-enable">
325
  <div class="method-header">
326
    <h3 class="method-name"><a href="#method-enable">enable</a></h3>
327
    <dl>
328
      <dt class="method-signature-label">Signature:</dt>
329
        <dd class="method-signature">.button( "enable"
330
 
331
 
332
 
333
 
334
 
335
 
336
 
337
)</dd>
338
    </dl>
339
  </div>
340
  <div class="method-description">
341
    <p>Enable the button.</p>
342
  </div>
343
</li>
344
 
345
 
346
<li class="method" id="method-option">
347
  <div class="method-header">
348
    <h3 class="method-name"><a href="#method-option">option</a></h3>
349
    <dl>
350
      <dt class="method-signature-label">Signature:</dt>
351
        <dd class="method-signature">.button( "option"
352
 
353
, optionName
354
 
355
, <span class="optional">[</span>value<span class="optional">] </span>
356
 
357
 
358
 
359
)</dd>
360
    </dl>
361
  </div>
362
  <div class="method-description">
363
    <p>Get or set any button option. If no value is specified, will act as a getter.</p>
364
  </div>
365
</li>
366
 
367
 
368
<li class="method" id="method-option">
369
  <div class="method-header">
370
    <h3 class="method-name"><a href="#method-option">option</a></h3>
371
    <dl>
372
      <dt class="method-signature-label">Signature:</dt>
373
        <dd class="method-signature">.button( "option"
374
 
375
, options
376
 
377
 
378
 
379
 
380
 
381
)</dd>
382
    </dl>
383
  </div>
384
  <div class="method-description">
385
    <p>Set multiple button options at once by providing an options object.</p>
386
  </div>
387
</li>
388
 
389
 
390
<li class="method" id="method-widget">
391
  <div class="method-header">
392
    <h3 class="method-name"><a href="#method-widget">widget</a></h3>
393
    <dl>
394
      <dt class="method-signature-label">Signature:</dt>
395
        <dd class="method-signature">.button( "widget"
396
 
397
 
398
 
399
 
400
 
401
 
402
 
403
)</dd>
404
    </dl>
405
  </div>
406
  <div class="method-description">
407
    <p>Returns the .ui-button element.</p>
408
  </div>
409
</li>
410
 
411
 
412
<li class="method" id="method-refresh">
413
  <div class="method-header">
414
    <h3 class="method-name"><a href="#method-refresh">refresh</a></h3>
415
    <dl>
416
      <dt class="method-signature-label">Signature:</dt>
417
        <dd class="method-signature">.button( "refresh"
418
 
419
 
420
 
421
 
422
 
423
 
424
 
425
)</dd>
426
    </dl>
427
  </div>
428
  <div class="method-description">
429
    <p>Refreshes the visual state of the button. Useful for updating button state after the native element's checked or disabled state is changed programatically.</p>
430
  </div>
431
</li>
432
 
433
    </ul>
434
  </div>
435
  <div id="theming">
436
    <h2 class="top-header">Theming</h2>
437
    <p>The jQuery UI Button plugin uses the jQuery UI CSS Framework to style its look and feel, including colors and background textures. We recommend using the ThemeRoller tool to create and download custom themes that are easy to build and maintain.
438
</p>
439
  <p>If a deeper level of customization is needed, there are widget-specific classes referenced within the jquery.ui.button.css stylesheet that can be modified. These classes are highlighed in bold below.
440
</p>
441
 
442
  <h3>Sample markup with jQuery UI CSS Framework classes</h3>
443
  &lt;button class=&quot;<strong>ui-button ui-button-text-only</strong> ui-widget ui-state-default ui-corner-all&quot;&gt;<br />
444
&nbsp;&nbsp;&nbsp;&lt;span class=&quot;<strong>ui-button-text</strong>&quot;&gt;Button Label&lt;/span&gt;<br />&lt;/button&gt;
445
  <p class="theme-note">
446
    <strong>
447
      Note: This is a sample of markup generated by the button plugin, not markup you should use to create a button. The only markup needed for that is &lt;button&gt;Button Label&lt;/button&gt;.
448
    </strong>
449
  </p>
450
 
451
  </div>
452
</div>
453
 
454
</p><!--
455
Pre-expand include size: 23021 bytes
456
Post-expand include size: 29105 bytes
457
Template argument size: 13482 bytes
458
Maximum: 2097152 bytes
459
-->
460
 
461
<!-- Saved in parser cache with key jqdocs_docs:pcache:idhash:3767-1!1!0!!en!2 and timestamp 20100909204132 -->