javascript validation1

 <!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <style>

        span{

            color:red;

        }

        .B{

border:2px solid red;

outline: none;

        }

    </style>

    <script>

        function f1(e){

            V=e.value;

           console.log(V)

            Id=e.id;

            console.log(Id);

            errid="err"+e.id;

            // alert(errid);

            if(!V){

                document.getElementById(errid).innerText="please fillname";

                document.getElementById(Id).focus();

            }

            if(V){

                document.getElementById(errid).innerText="";

            }

        }

        function f2(){

            // document.getElementById(errid).innerText="";

        }

           </script>

</head>

<body>

    <form action="login.py">

        <label for="name">Name</label>

        <input type="text" name="nm" id="nm"

         onblur="f1(this)" onfocus="f2(this)"

        >

<span id='errnm'></span>


Comments

Popular posts from this blog

interview questions js[ Anurag Singh ProCodrr]

reactnative_creation