Title: enter key on textbox Post by: crosemffet on January 21, 2016, 01:40:25 AM hello everybody and thanks again for your support.
I have one textbox in my chat window. the idea is send the message on enter key (13). that's my textbox: <input id="write_input" class="easyui-textbox" data-options="prompt:'write here...',iconWidth:22,icons:[{iconCls:'icon-add',handler:function(e){sendChatMessage($(e.data.target).textbox('getValue'),'1');}}]" style="width:238px;height:24px;"> var t = $('#write_input'); t.textbox('textbox').bind('keydown', function(e){ if (e.keyCode == 13){ // when press ENTER key, accept the inputed value. t.textbox('setValue', $(this).val()); } }); the textbox works like a charm, except that I need to send the message on enter key, not only on icon-add click, and when I add the line: t.textbox('textbox').bind ..... trows error (unable to get the value of the property textbox. object is null or undefined. any idea...? thanks in advance, Title: Re: enter key on textbox Post by: stworthy on January 21, 2016, 07:24:09 PM You should put your code inside $(document).ready() block.
Code: $(document).ready(function(){ Title: Re: enter key on textbox Post by: bvn on July 20, 2017, 08:16:23 AM What about another controls?
For example 'passwordbox' and 'switchbutton'. I tryied to do $('#password').passwordbox('passwordbox').bind('keyup', ... ); but it does not effect. Title: Re: enter key on textbox Post by: stworthy on July 21, 2017, 03:29:37 PM Please call the 'textbox' method to get the inputing box and bind events on it.
Code: $('#password').passwordbox('textbox').bind('keyup', ... ); |