我有下面的代碼運行etape.html
啓動頁面,它允許插入HTML元素與迭代n
html塊。動態插入新的html元素
對於第一次迭代一切都很好,會出現,但在第二次迭代沒有出現在div塊。
次要考慮的是在按下執行「Suivant」按鈕,允許重新加載頁面etape.html
有人有任何想法?
index=0;
$("#etape").live('pageshow', function() {
if(index>5)
{
//Go to other Page
}
switch(id_type_champ)
{
case 1:
$('#header-right-container').append(''+nom_champ+'<input type="text" id='+Id+' > ').trigger("create");
alert("case 1");
break;
case 2:
$('#header-right-container').append(''+nom_champ+'<input type="text" id='+Id+' > ').trigger("create");
alert("case 2");
break;
case 3:
$('#header-right-container').append(''+nom_champ+'<input type="date" id='+Id+' OnClick="aff_date(\'' + Id + '\')">').trigger("create");
alert("case 3");
break;
case 4:
$('#header-right-container').append(''+nom_champ+'<select id='+Id+' ><option value=0></option></select>').trigger("create");
alert("case 4");
break;
case 5:
$('#header-right-container').append(''+nom_champ+'<select id='+Id+' ><option value=0> </option></select> ').trigger("create");
alert("case 5");
break;
case 6:
$('#header-right-container').append(''+nom_champ+'<select id='+Id+' ><option value=0> </option></select> ').trigger("create");
alert("case 6");
break;
case 7:
$('#header-right-container').append(''+nom_champ+'<select id='+Id+' ><option value=0> </option></select> ').trigger("create");
alert("case 7");
break;
case 8:
$('#header-right-container').append(''+nom_champ+'<select id='+Id+' ><option value=0> </option></select> ').trigger("create");
alert("case 8");
break;
case 9:
$('#header-right-container').append(''+nom_champ+'<select id='+Id+' ><option value=0> </option></select> ').trigger("create");
alert("case 1");
break;
default:
$('#header-right-container').append(''+nom_champ+'<select id='+Id+' ><option value=0> </option></select> ').trigger("create");
alert("case 1");
break;
}
$('#header-left-container').append('<a href="etape.html" data-role="button" OnClick="DoAction()" data-icon="arrow-r" data-iconpos="right" data-theme="a" id="suivant">Suivant</a> ').trigger("create");
}
function DoAction()
{
//$('#'+id+'').val() ; //GET text
//$('#'+id+'').val('AAAAAA'); //SET
index++;
alert('Button has been clicked avec un index = a '+ index);
}
這是否第二次迭代發生在何時?它的代碼在哪裏? –
不使用'onclick',這是SOOOO壞的,它只是破壞什麼jQuery是一回事,...... – Val
@val好吧,我該怎麼用呢? –