JQuery mobile: Tap event on listview item also fires hidden object event -


i'm having problem tap event on dynamically-generated listview. when select first item in list, actions fires, 1 of unhide object nearby. problem unhidden object's tap event fires @ time. don't have extensive background in programming, in software testing can expect thorough replication steps. :)

this event fires when list item selected:

//when list item selected     $('#showitems').delegate('li', 'tap', function () {         if ($('#showitems').hasclass("courses")){             coursenum = $(this).find('.course').text();             var profarr=new array();             profarr[0]="";             profarr[1]="";             ajax_get_textbooks(coursenum, profarr[1], profarr[0]);             $('#showitems').removeclass('profs courses booksprof eitems').addclass('books');         }         else if ($('#showitems').hasclass("profs")){             prof = $(this).text();             profarr = prof.split(", ");             ajax_get_textbooks(coursenum, profarr[1], profarr[0]);             $('#showitems').removeclass('profs courses books eitems').addclass('booksprof');         }         $('#filters').removeclass('hidden'); // object gets acted upon incorrectly     }); 

and event gets fired when first list element selected:

//when filter professor/e-resources selected  $('.filterbtn').bind('tap',function(event){     var filter = $(this).text();     filter = filter.tolowercase();     if (filter.indexof("prof") !== -1 ) {         ajax_filter_professor(coursenum);         $('#showitems').removeclass('books courses booksprof eitems').addclass('profs');     }     else {         ajax_filter_eresources(coursenum);           $('#showitems').removeclass('books profs booksprof courses').addclass('eitems');     }     $('#showitems').listview('refresh'); }); 

i thought work around problem attaching taphold event same function, following line doesn't work:

$('#showitems').delegate('li', 'tap taphold', function () { 

it works when copy same code new event trigger taphold.

i'd able somehow disable $('.filterbtn').bind until first list has finished refreshing, can't figure out how that.

here replication steps

  1. http://library.iit.edu/mbad/#textbooks enter "hu" in textbox. course list propogates.
  2. slect first list item (hum102).
  3. notice mouse hovering on 1 of 2 buttons: "by prof" or "e-items." if testing on phone, 1 of button events fire.

can me figure out i'm doing wrong?

maybe can try using vclick event of jqm. see list of events supported in jqm on http://jquerymobile.com/test/docs/api/events.html if not vclick else might fit.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -