<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>ajax file</title> <script src="./js/jquery-1.12.4.min.js"></script> <script> $(function(){
// 是否有值,如果有值为true 否则为false
if($(".bloo").text()){ alert("heiheihei") }else{
alert("++++++++++")
} }); </script> </head> <body> <div class="box" a=""> 嘿嘿 </div> <input type="text" value="嘿嘿"> <div class="bloo">嘿嘿</div> </body> </html>