javascript - 检查字符串以查看其是否为空

标签 javascript html

if($(this).find("Dimension1").text()) is blank
display nothing
else if ($(this).find("Dimension1").text()) has a value
put a "x" before printing $(this).find("Dimension1").text()

所以它将是 "x"+ Dimension1

我怎么用javascript写这个

最佳答案

str= $(this).find("Dimension1").text();
if (str!="")
str = "x"+str;

关于javascript - 检查字符串以查看其是否为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9359197/

相关文章:

javascript - 如何更新 $scope.update 中传递的值?

html - Angular - 通过不同的框架附加 html,每个框架一个模块

html - 嵌套选项卡之间的空间

css - 即使位置设置为相对且不透明度设置为 0.99,z-index 也无效

javascript - 如何使我的网页主要内容可点击/可访问?

javascript - 在移动浏览器中显示模式弹出窗口以及调整浏览器窗口大小时出现问题

javascript - 函数和函数有什么区别*

Javascript 拖放问题

javascript - 在 php/javascript 中获取时间

PHP 和 MYSQL : When i edit and update my database only the very first column will update