javascript - How to refine my jQuery to always work in IE8, currently it is hit and miss -


i have webpage takes in number values user , plots them on grid. here example of jquery used when set of numbers inputted:

$('#c_per,#c_pot').keyup(function() {         $('.ls_ref').each(function() {             if($(this).text().search('c') > 0) {                 countdown(this.id);             }             $(this).text($(this).text().replace('c', ''));         });         if($('#c_per').val() > 0 && $('#c_pot').val() > 0) {             setgridposition('c',$('#c_per').val(),$('#c_pot').val());         }         var c_per = +$('#c_per').val() || 0;         var c_pot = +$('#c_pot').val() || 0;         $('#c_tot').val(c_per + c_pot);     }); 

c_per , c_pot 2 input:text user places numbers in. category corresponding each set of numbers can appear once in grid, hence first function within given keyup event function. next checks see both inputs have value in them , calls setgridposition function. rest adds total of 2 numbers , makes sure function doesn't crash when there no value in 1 of 2 inputs.

function setgridposition(cat,per,pot) {     var id = "ls_" + per + "_" + pot;     $('#'+id).append(cat);     var check = per + "-" + pot;     switch(check) {         case '1-1': case '2-1': case '1-2': case '2-2':             counts.q_1 += 1;             switch(check) {                 case '1-1':                     priority_one_count.s_1_1++; break;                 case '2-1':                     priority_one_count.s_2_1++; break;                 case '1-2':                     priority_one_count.s_1_2++; break;                 case '2-2':                     priority_one_count.s_2_2++; break;             }                 break;         case '3-1': case '4-1': case '5-1': case '3-2': case '4-2': case '5-2':             counts.q_2 += 1;             switch(check) {                 case '3-1':                     priority_two_count.s_3_1++; break;                 case '4-1':                     priority_two_count.s_4_1++; break;                 case '5-1':                     priority_two_count.s_5_1++; break;                 case '3-2':                     priority_two_count.s_3_2++; break;                 case '4-2':                     priority_two_count.s_4_2++; break;                 case '5-2':                     priority_two_count.s_5_2++; break;             }             break;         case '3-3': case '4-3': case '3-4':             counts.q_3 += 1;             switch(check) {                 case '3-3':                     priority_three_count.s_3_3++; break;                 case '4-3':                     priority_three_count.s_4_3++; break;                 case '3-4':                     priority_three_count.s_3_4++; break;             }             break;         case '5-3': case '4-4': case '3-5':             counts.q_4 += 1; break;         case '5-4': case '4-5': case '5-5':             counts.q_5 += 1; break;         default: counts.q_6 += 1;     } } 

most of function keeping track of stats need compile. not sure if falling-through switch statements effecting ie8.

i tried jsfiddle.net work site, can't figure out. have temporary site setup can check out full version. -link removed-

this code works every time chrome , firefox , works 95% of time ie8 (required support). 9/11 sets of numbers generates position on grid correctly.

is there in code ie8 has trouble with?

a wild guess, don't need break; last default: statement? within set of switches , perhaps making jump case pretty way case 'whatever' : case 'yeah' : can try add break default statement? looks complicated algorithm, that's issue.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -