1

i am getting this error in my chrome console.username availaibility is workig fine. but password strength is not working. i m new in javascript please help me..

<script type="text/javascript">
    $(function()
    {
      $('.user_name').keyup(function()
      {
      var checkname=$(this).val();
     var availname=remove_whitespaces(checkname);
      if(availname!='' && availname.length  >= 5 ){
      $('.check').show();
      $('.check').fadeIn(400).html('</br> </br> <img src="img/ajax-loading.gif"  style="height:20px;width:20px" /> ');

      var String = 'username='+ availname;

      $.ajax({
              type: "POST",
              url: "available.php",
              data: String,
              cache: false,
              success: function(result){
                   var result=remove_whitespaces(result);
                   if(result==''){
                           $('.check').html(' </br> </br> <img src="img/accept.png"  style="height:20px;width:20px" /> This Username Is Avaliable');
                           $(".check").removeClass("red");
                           $('.check').addClass("green");
                           $(".user_name").removeClass("yellow");
                           $(".user_name").addClass("white");
                   }else{
                           $('.check').html('</br> </br><img src="img/error.png"  style="height:20px;width:20px" /> This Username Is Already Taken');
                           $(".check").removeClass("green");
                           $('.check').addClass("red")
                           $(".user_name").removeClass("white");
                           $(".user_name").addClass("yellow");
                   }
              }
          });
       }else{
           $('.check').html('');

       }
      });

    $('.passwd').password_strength(); 

    });

    function remove_whitespaces(str){
         var str=str.replace(/^\s+|\s+$/,'');
         return str;



    }
    </script>

i am getting this error in my chrome console.username availaibility is workig fine. but password strength is not working. i m new in javascript please help me..


You haven't defined the jQuery plugin/attached a jQuery plugin called password_strength().

Either import it via the script tags or however you choose to load your scripts or define a jQuery plugin of your own ie. write it yourself.

And also loading the scripts in the right order is crucial since the password strength plugin relies on jQuery.

4

2 回答 2

0

You include password jquery script after jquery script then it will works..

1.Jquery 2.Password

于 2013-10-25T04:42:47.727 回答
0

您尚未定义 jQuery 插件/附加一个名为password_strength().

通过脚本标签导入它,或者您选择加载脚本或定义您自己的 jQuery 插件,即。自己写。

而且以正确的顺序加载脚本也很重要,因为密码强度插件依赖于 jQuery。

于 2013-10-25T04:34:16.460 回答