JS 判断特殊字符

 var orderCode=$("#orderCode").val();
       var scheduledProducedUnits=$("#scheduledProducedUnits").val();
       
       var str=/^[^@\/\'\\\"#$%&\^\*]+$/;
      
       
       if(isNaN(scheduledProducedUnits)){
      new PNotify({
               text: '计划生产数量必须是数字',
               type: 'error',
               styling: 'bootstrap3'
           });
  return false;
       }else if(orderCode==""){
      new PNotify({
               text: '订单编号不能为空',
               type: 'error',
               styling: 'bootstrap3'
           });
  return false;
   
       }else if(/[@\/'\\"#$%&--\^*]/.test(orderCode)){
      new PNotify({
               text: '订单编号包含敏感字符',
               type: 'error',
               styling: 'bootstrap3'
           });
  return false;

你可能感兴趣的:(web,form)