Closed OwenBrotherwood closed 12 years ago
I'm experiencing this problem as well, tested on iOS 4.3.3 and Firefox 5.
Since upgrading to 1.0b1 from 1.0a4.1 the 'keyup' and 'change' events do not fire on 'search' input types. Changing the type to 'text' does work.
http://forum.jquery.com/topic/jquery-mobile-1-0b1-bind-with-keyup-problem#14737000002511387 Looks like a timing issue Kicking off the binds with document ready may be too quick for JQM. Playing with the fiddle @ http://jsfiddle.net/Kuyne/1/light/ If one wraps the the binds in a function( doit) with a setTimeout(doit, 1), it gets the search to bind. Without the setTimeout: no bind to search .. http://jsfiddle.net/7EMZa/
(Also, if one places the bindings in the javascript section at jsfiddle, the search works: strange but true http://jsfiddle.net/Kuyne/2/ )
<script type="text/javascript">
function doit(){
var t;
t=$('#bing').bind('keyup', function(){
alert("Did keyup work ...?");
});
console.log(t);
t=$('#bang').bind('click', function(){
alert("Did click work ...?");
});
console.log(t);
t=$('#bong').bind('keyup', function(){
alert("Did keyup work ...?");
});
console.log(t);
}
$(document).ready(function(){
setTimeout(doit, 1);
});
</script>
Added a fiddle that uses "latest" code instead of b1 so as to be nice :) Pt. still no events for search http://jsfiddle.net/jqPs5/
live contra bind
I have to understand "live": but the original code is now fiddled to use live and works...
Not sure if this is an issue or not: but it is tripping people. Should it be closed or commented on?
Due to other problems in code, live was not enough, used a live plus a timeout to get search to work
I lost some hours to this issue too and have not found an workaround yet. Thank you OwenBrotherwood for providing the fiddles. I'll look into it in the next few days but help from the "gurus" would be warmly appreciated.
Thanks for all the diagnostic info guys, we'll take a look.
Just a couple of notes: another topic about same problem @ http://forum.jquery.com/topic/keypress-handler-in-input-type-search : something to do with div usage ... but as I use ID in my markup, not sure of the "fix"
Otherwise, I am wrapping my "bind"/live statements in the following which seems to work.
$(document).ready(function(){ $('#appPage').live('pagecreate',function(){ // ok, JQM has finished markup so bind/live can be done
Think scot fixed issue when He redid widgets.
http://jsfiddle.net/Kuyne/1/
bind for keyup on input type search: produces no keyup event. bind for keyup on input type text: works
http://forum.jquery.com/topic/jquery-mobile-1-0b1-bind-with-keyup-problem
Problem on multiple platforms
1.0a4.1 of JQM works with the enclosed markup http://jsfiddle.net/TWdug/