[英]How can I change the code so that it can execute?
I use jQuery to develop mobile applications. 我使用jQuery开发移动应用程序。 The problem is that when I add 5 or 6 lines to the page, all goes well, but if I add say 120 lines it displays an error message:
Javascript execution exceeded timeout
. 问题是,当我在页面上添加5或6行时,一切正常,但是如果添加120行,则会显示错误消息:
Javascript execution exceeded timeout
。
function succes_recu_list_rubrique(tx, results) { //après avoir rempli sqlite
console.log('ENTRééééééééééééééé---');
$('#lbtn').prepend("<legend>Sélectionner une rubrique</legend><br>");
for(var i=0; i<results.rows.length; i++) {
//Remplir tableau liste des identifiants étapes
$('#lbtn').append("<input name='opt1' checked type='radio' value="+results.rows.item(i).IdRubrique+" id="+results.rows.item(i).IdRubrique+" />");
$('#lbtn').append('<label for='+results.rows.item(i).IdRubrique+'>'+results.rows.item(i).LibelleRubrique+'</label>');
}
$('#lbtn').append('<a href="#page_dialog2" class="offer2" data-rel="dialog" data-role="button" >Consulter</a>').trigger('create');
$('#lbtn').append('<a href="#'+id_grp_rub+'" data-role="button" data-rel="back" data-theme="c">Cancel</a>').trigger('create');
}
无需调用.append
四个不同的时间,您可以一次将所有html放在一个字符串中,并在两个新创建的锚点上调用一个触发器。
Create a local variable for your selection: 创建一个本地变量供您选择:
var temp = $('#lbtn')
add all your lines to that variable 将所有行添加到该变量
temp += "code here";
etc. 等等
and then append to the element once. 然后一次附加到元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.