Home > Net >  Showing some error in JQuery, how should I fix it
Showing some error in JQuery, how should I fix it

Time:06-26

The error:

jQuery.Deferred exception: $(...).validate is not a function TypeError: $(...).validate is not a function at HTMLDocument. (http://127.0.0.1:5500/WebDevelopment/htmlJs.js:2:23) at mightThrow (https://code.jquery.com/jquery-3.6.0.js:3766:29) at process (https://code.jquery.com/jquery-3.6.0.js:3834:12) undefined

jQuery code:

$(document).ready(function() {
    $("#signup-form").validate( {
        rules:{
            inp1:{
                required:true
            }
        }
    })
})

HTML code:

<form id="signup-form">

    <label>Name:</label>
    <input name="inp1" type="text" placeholder="Name">
    <br>
    <label>Password:</label>
    <input type="text" id="">
</form>
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
<script scr="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.validate.js"></script>
<script src="htmlJs.js"></script>

CodePudding user response:

its because you have a typo on "scr=" it needs to be "src="

<script scr="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.validate.js"></script>

should be

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.validate.js"></script>

I hope this helps

  • Related