Cordova App按钮无法使用

时间:2017-01-13 17:16:55

标签: javascript android cordova

我在华为使用我的cordova应用程序时出错,其中一个按钮不起作用并冻结我的整个应用程序。我已经在浏览器上测试了它和三星同样工作。我在服务我的应用程序时使用了远程调试有了phonegap并且点击事件丢失了,它只听'deviceready'。其他按钮都有所有事件处理程序。有人有关于这个错误的想法以及为什么我在华为有它? 按钮的完整代码

 //ADD NEW CATEGORY
    $("#submit").on('click',addNewCategory);

    function addNewCategory(){
            event.stopPropagation();

       if(myAux==0 && myAux2==0){
         //show buttons
         showInputMenu();
         myAux2=1;
       }
       else if(myAux==0 && myAux2==1){
         //hide buttons
         hideInputMenu();
         myAux2=0;
       }

      else if(myAux==1){
      //get the value of the input and add it to the array
      var inputValue=$("#value").val();
      var result=checkCategory(inputValue);
      if( result == 0)
      {
        var titleArrGet = localStorage.getItem("titleArrGet");
        titleArrGet = (titleArrGet) ? JSON.parse(titleArrGet) : [];
        titleArrGet.push(inputValue);
        //save the new array in local storage
        localStorage.setItem("titleArrGet",JSON.stringify(titleArrGet));
        //update the content from right
        var newTitle=JSON.parse(localStorage.getItem("titleArrGet"));
        var li=$("<li></li>").text(newTitle[newTitle.length-1]);
        var div=$("<div></div>").addClass("listRectangle");
        li.append(div);
        $("#categoryList").append(li);
        //update the page content (or just use location.reload())
        var h1=$("<h1></h1>").text(newTitle[newTitle.length-1]);
        h1.append($("<i class='fa fa-trash-o'></i>"));
        var ul=$("<ul></ul>");
        ul.append(h1);
        $("#myMusicList").append(ul);
        //empty the input field
        $("#value").val('');
        hideInput();

      }//end if statement
    else if(result == 1){
          $("#popUp p").text("The category already exist")
          $("#popUp").css('top','0px');
          setTimeout(function(){
              $("#popUp p").text("")
              $("#popUp").stop().css('top','-100px');
              },3000);
          }//end else statement
    else
      {
      //hide menu
      hideInput();
      hideInputCategory();

        }//end main else statement
   };//end function
}

0 个答案:

没有答案