Cordova 长度不适用于jquery mobile?
(我使用jquerymobile和Phonegap) 我试图在数据库中插入行,但如果包含的行不是空的,我希望插入行。下面是我的代码Cordova 长度不适用于jquery mobile?,cordova,jquery-mobile,Cordova,Jquery Mobile,(我使用jquerymobile和Phonegap) 我试图在数据库中插入行,但如果包含的行不是空的,我希望插入行。下面是我的代码 for (var i = 0; i < id_textarea_commenter.length ; i++) { var sql ="INSERT INTO Commenter (IdPrestation, IdTypeCommentaire, IdGroupe, Commentair
for (var i = 0; i < id_textarea_commenter.length ; i++)
{
var sql ="INSERT INTO Commenter (IdPrestation, IdTypeCommentaire, IdGroupe, Commentaire, rowguid)" +
"VALUES (?,?,?,?,?)";
Commentaire =$('textarea#'+id_textarea_commenter[i]+'').val();
IdTypeCommentaire =id_textarea_commenter[i];
if( (Commentaire!= " ") || (Commentaire!= "") || (Commentaire.length!= 0) )
{
console.log(Commentaire +"--------"+ IdTypeCommentaire );
params = [IdPrestation,IdTypeCommentaire, IdGroupe, Commentaire, rowguid];
tx_commenter.executeSql(sql, params);
console.log("I= "+i);
}
}
for(变量i=0;i
我试图在数据库中插入行,但如果包含的行不是空的,我希望插入行。下面是我的代码
for (var i = 0; i < id_textarea_commenter.length ; i++)
{
var sql ="INSERT INTO Commenter (IdPrestation, IdTypeCommentaire, IdGroupe, Commentaire, rowguid)" +
"VALUES (?,?,?,?,?)";
Commentaire =$('textarea#'+id_textarea_commenter[i]+'').val();
IdTypeCommentaire =id_textarea_commenter[i];
if( (Commentaire!= " ") || (Commentaire!= "") || (Commentaire.length!= 0) )
{
console.log(Commentaire +"--------"+ IdTypeCommentaire );
params = [IdPrestation,IdTypeCommentaire, IdGroupe, Commentaire, rowguid];
tx_commenter.executeSql(sql, params);
console.log("I= "+i);
}
}
问题是,即使插入字段也是空的
我应该如何解决这个问题并提前感谢您我想您应该使用&¬||
if( (Commentaire!= " ") && (Commentaire!= "") && (Commentaire.length!= 0) )
根据您的页面,您可能需要检查Commentaire!=也未定义