2016-11-11 70 views
0

我得到这个错误。我不知道这里发生了什么。

enter code here 
$(".addCategory").on('click',function(){ 
     var value= $(".getvalue").val(); 
     var x = $("input[name="+value+'[]'"]") 
     $(x).each(function(key,val){ 
     if($(val).val().length<=0) 
     { 
      alert ("Please fill all the fileds"); 

     } 

     }); 
    }); 

回答

3

你必须加上引号

var x = $("input[name='" + value + "[]']") 
0

问题见究竟应该如何收官

var x = $("input[name='"+value+"[]']") 
2

问题是与你的报价: 与下面的代码

$(".addCategory").on('click',function(){ 
      var value= $(".getvalue").val(); 
      var x = $("input[name='"+value+"[]']") // add proper quotes 
      $(x).each(function(key,val){ 
      if($(val).val().length<=0) 
      { 
       alert ("Please fill all the fileds"); 

      } 

      }); 
     }); 
更换
相关问题