if()为false时,如何编写其他脚本 [英] How do I script else , when if() is false

查看:69
本文介绍了if()为false时,如何编写其他脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(div [id ='tabcontent'])。find('a')。each(function(){

if($(this).text()== 立即预订){

// if()为真时执行正确

}

});



//我如何写脚本{},当if()是故事时



我试过的:



$(div [id ='tabcontent'])。find('a')。each(function(){

if($(this).text()==立即预订){

//运行代码

}

});

//我试过这个

else {

//运行代码

}

解决方案

(this).text()==立即预订){

//当if时它正确执行)是真的

}

});



//我怎么写脚本{},如果if ()是故事



我尝试过:



(div [id ='tabcontent'])。find('a')。each(function(){

if(

< br>

(this).text()==立即预订){

//运行代码

}

});

//我试过这个

else {

//运行代码

}

$("div[id='tabcontent']").find('a').each(function () {
if ($(this).text() == "Book Now") {
// it is execute properly when if() is true
}
});

//how i script else{}, when if() is fale

What I have tried:

$("div[id='tabcontent']").find('a').each(function () {
if ($(this).text() == "Book Now") {
// run code
}
});
// i tried like this
else{
// run code
}

解决方案

(this).text() == "Book Now") {
// it is execute properly when if() is true
}
});

//how i script else{}, when if() is fale

What I have tried:


("div[id='tabcontent']").find('a').each(function () {
if (


(this).text() == "Book Now") {
// run code
}
});
// i tried like this
else{
// run code
}


这篇关于if()为false时,如何编写其他脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆