2011-07-15 37 views
0

我有一個可摺疊的時間,如在屏幕截圖..和下拉列表..在下拉列表中,你可以選擇時間如何collapsible將分開時間..當我第一次打開活動.. 。它工作正常,但是當我選擇droplist另一個時間和他更新collapsibles輸入丟失了自己的風格,而不是工作..Jquery移動輸入在崩潰的問題

enter image description here

這裏是droplist改變事件 - >>

    $('#timeDropList').change(function() { 
         $('div.addedEntry').remove(); 
         drawTemplate(); 
        }); 

和這裏是繪製可摺疊的功能上 - >>

 function drawTemplate() { 
      var selectedValue = parseInt($('#timeDropList').val()); 

      var textProjectName = '<input type="text" class="projectName" value="" />'; 
      var textProjectData = '<input style="height:50px;" type="text" class="projectEntry" value="" />'; 

      var timespan; 
      if ($('.div-cell').hasClass('tapped')) { 
       var calToScheDate = $('.div-cell.tapped').find('.dayNumberCellValue') 
         .attr('data-a'); 

       var calToScheMonth; 
       var calToScheDay; 
       if (calToScheDay = calToScheDate.substring(6, 8) < 10) { 
        calToScheDay = calToScheDate.substring(7, 8); 
       } else { 
        calToScheDay = calToScheDate.substring(6, 8); 
       } 
       if (calToScheMonth = calToScheDate.substring(4, 6) < 10) { 
        calToScheMonth = calToScheDate.substring(5, 6); 
       } else { 
        calToScheMonth = calToScheDate.substring(4, 6); 
       } 
       timespan = new Date(calToScheDate.substring(0, 4), calToScheMonth, 
         calToScheDay, 9, 0); 
      } else { 
       timespan = new Date(); 
       timespan = new Date(timespan.getFullYear(), timespan.getMonth(), 
         timespan.getDate(), 9, 0); 

      } 


      while (timespan.getHours() < 18 || timespan.getHours() == 18 
        && timespan.getMinutes() == 0) { 
       var hoursFrom = timespan.getHours(); 
       var minsFrom = timespan.getMinutes(); 
       if (minsFrom < 10) { 
        minsFrom = "0" + minsFrom; 
       } 
       if (hoursFrom < 10) { 
        hoursFrom = "0" + hoursFrom; 
       } 
       var hoursTo = timespan.getHours(); 
       var minsTo = timespan.getMinutes() + selectedValue 
       if (minsTo == 60) { 
        minsTo = "00"; 
        hoursTo++; 
       } else if (minsTo < 10) { 
        minsTo = "0" + minsTo; 
       } 

       var collDiv = '<div class="addedEntry" data-theme="c" data-role="collapsible" id='+hoursFrom+minsFrom+hoursTo+minsTo+' data-collapsed="true"><h3 class="results-header">' 
         + hoursFrom 
         + ":" 
         + minsFrom 
         + " - " 
         + hoursTo 
         + ":" 
         + minsTo +'</h3>' + '</div>'; 
       $('.spanTimetable').append(collDiv); 

       timespan.setMinutes(timespan.getMinutes() + selectedValue); 
      } 
      $('.addedEntry').append(textProjectName); 
      $('.addedEntry').append(textProjectData); 

      $('.results-header').append('<img class="checkOrCross" />'); 
      $('#timetable .addedEntry').collapsible({ 
       refresh : true 
      }); 
     } 

回答

0

您需要使用。第()刷新JQM

也許嘗試:

$('#timeDropList').change(function() { 
    $('div.addedEntry').remove(); 
    drawTemplate(); 
}); 

$('#name of your page').page(); 
+0

沒有..這並沒有幫助 – Sergio

+0

嗯嘗試更新 –

+0

沒有工作太 – Sergio