EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
February 13, 2025, 01:35:34 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
EasyUI Forum
>
General Category
>
General Discussion
>
Textbox bind keydown event failure
Pages: [
1
]
« previous
next »
Print
Author
Topic: Textbox bind keydown event failure (Read 8148 times)
wymak
Newbie
Posts: 26
Textbox bind keydown event failure
«
on:
December 26, 2016, 03:46:16 AM »
I write a short code to display the number of character user input into the textbox, on each textbox.keydown event.
However, the code did not work for user input greater than 1 character. It work again if I put an 'alert()' function inside, as shown, please enlighten me.....
<input id='title' class='easyui-textbox'> </div>
<div id='count'></div>
<script type="text/javascript">
$(function(){
$('#title').textbox('textbox').bind('keydown', function (e) {
s = $('#title').val();
cnt = (s.length+1).toString();
// uncomment the following and the program will work
//alert(cnt);
$('#count').text(cnt);
});
}); // end $function()
</script>
Logged
jarry
Administrator
Hero Member
Posts: 2283
Re: Textbox bind keydown event failure
«
Reply #1 on:
December 26, 2016, 07:09:55 AM »
Please use this code instead.
Code:
$('#title').textbox('textbox').bind('keydown', function (e) {
s = $(this).val();
//...
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News
=> General Discussion
=> EasyUI for jQuery
=> EasyUI for Angular
=> EasyUI for Vue
=> EasyUI for React
=> Bug Report
Loading...