相关疑难解决方法(0)

如何在JavaScript中检查empty/undefined/null字符串?

我看到了这个帖子,但我没有看到JavaScript特定的例子.有一个简单string.Empty的JavaScript可用,还是只是检查的情况""

javascript null is-empty

2645
推荐指数
45
解决办法
276万
查看次数

C#String.IsNullOrEmpty Javascript等价物

我想尝试String.IsNullOrEmpty(string)在javascript中执行等效于C#的字符串调用.假设有一个简单的电话,我在网上看了,但我找不到一个.

现在我正在使用一个if(string === "" || string === null)声明来覆盖它,但我宁愿使用一个预定义的方法(我继续得到一些由于某种原因滑倒的实例)

什么是最接近的javascript(或jquery,如果有一个)调用是相等的?

javascript jquery

79
推荐指数
4
解决办法
6万
查看次数

Chrome值加载

我在浏览器Chrome时遇到一些问题,它会记住密码,用户名等.我无法检查输入字段是否为空.我使用以下代码,但if语句在Chrome中不起作用,而它适用于所有其他浏览器.

$(document).ready(function() {    
    $('.inputWithLabel').each(function(){
        if ($(this).val().length != 0){
            var element_id = $(this).attr('id');
            $('label[for="' + element_id + '"]').addClass('inputWithText');
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

我试图改变以下标签

<form action="" method="post">
    <div class="divInputLabel inputLabel">
        <label class="labelInput" for="username">Brugernavn*</label>
        <input class="inputLabel inputWithLabel" id="username" name="username" type="text">
    </div>
    <div class="divInputLabel inputLabel">
        <label class="labelInput" for="password">Adgangskode*</label>
        <input class="inputLabel inputWithLabel" id="password" name="password" type="password">
    </div>
    <div class="divInputLabel inputLabel">
        <label class="labelInput" for="password_again">Gentag adgangskode*</label>
        <input class="inputLabel inputWithLabel" id="password_again" name="password_again" type="password">
    </div>
    <div class="divInputLabel inputLabel">
        <label class="labelInput" for="first_name">Fornavn*</label>
        <input class="inputLabel inputWithLabel" id="first_name" name="first_name" type="text">
    </div>
    <div …
Run Code Online (Sandbox Code Playgroud)

javascript jquery google-chrome

18
推荐指数
1
解决办法
571
查看次数

JS如何检查空字符串和空格

帮帮我吧

if(value == ""){
// do anything
}
Run Code Online (Sandbox Code Playgroud)

但我需要检查空格""(2,3,......空间是否包含)是否与空字符串相同

PS.对不起,我的英文

javascript appcelerator-titanium

8
推荐指数
1
解决办法
3817
查看次数

如何检查asp文本框是否为空

可能重复:
使用javascript进行文本框空检查

我有一个asp.net按钮和一个asp.net文本框,当我点击按钮时,我想检查文本框是否为空,但不确定我是如何做到的,

<div>
    <asp:TextBox ID="txtEU" runat="server"></asp:TextBox>
</div>
<div>
    <asp:ImageButton ID="button" runat="server" OnClientClick="MyFunction(); return false;" ImageUrl="/myfolder/abc.png" />
</div>
Run Code Online (Sandbox Code Playgroud)

在我的JavaScript中,我正在做,

   <script type="text/javascript">
    function doWork() 
    {  
        if($input[]
Run Code Online (Sandbox Code Playgroud)

不确定如何检查它是否为空,如果它是空的,那么我正在做一些事情,如果没有那么它应该调用该按钮的方法后面的代码.

javascript c# asp.net

1
推荐指数
2
解决办法
4万
查看次数