Tizen 2.0 Release
[samples/web/TizenWinset.git] / widgets / tokentextarea-demo.js
1 ( function ( $, window ) {
2         $( document ).ready( function () {
3                 $( "#MBTaddItemTest" ).click( function () {
4                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "add", "additem" );
5                 });
6
7                 $( "#MBTremoveItemTest" ).click( function () {
8                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "remove", 0 );
9                 });
10
11                 $( "#MBTinputTextTest" ).click( function () {
12                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "inputText", "Hello~~~" );
13                 });
14
15                 $( "#MBTgetInputTextTest" ).click( function () {
16                         var input = $( ":jqmData(role='tokentextarea')" ).tokentextarea( "inputText" );
17                         window.alert( "input String : " + input );
18                 });
19
20                 $( "#MBTremoveAllItemTest" ).click( function () {
21                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "remove" );
22                         $( ":jqmData(role='tokentextarea')" ).parents( ".ui-scrollview-view" ).parent().scrollview( "scrollTo", 0, 0 );
23                 });
24
25                 $( "#MBTgetSelectedItemTest" ).click( function () {
26                         var content = $( ":jqmData(role='tokentextarea')" ).tokentextarea( "select" );
27                         window.alert( "Select content : " + content );
28                 });
29
30                 $( "#MBTselectItemTest" ).click( function () {
31                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "select", 0 );
32                 });
33
34                 $( "#MBTlengthTest" ).click( function () {
35                         var length = $( ":jqmData(role='tokentextarea')" ).tokentextarea( "length" );
36                         window.alert( "length : " + length );
37                 });
38
39                 $( "#MBTfocusInTest" ).click( function () {
40                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "focusIn", 0 );
41                 });
42
43                 $( "#MBTfocusOutTest" ).click( function () {
44                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "focusOut", 0 );
45                 });
46
47                 $( "#MBTdestroyTest" ).click( function () {
48                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "destroy" );
49                 });
50
51                 $( "#contentList a" ).click( function () {
52                         var arg = $( this ).text();
53                         $( ":jqmData(role='tokentextarea')" ).tokentextarea( "add", arg );
54                 });
55
56                 $( "#cancelBtn" ).click( function () {
57                         $.mobile.changePage( "#tokentextarea", {
58                                 transition: "reverse slide",
59                                 reverse: false,
60                                 changeHash: false
61                         } );
62                 });
63         });
64 } ( jQuery, window ) );