Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

Is there any code to download video from Youtube on Java and Android?

1 Answer

0 votes
by (13.1k points)

For validating the email, <input type = “email”> is enough.

For mobile number use pattern attribute for attribute input as follows:

<input type="number" pattern="\d{3}[\-]\d{3}[\-]\d{4}" required>

For focusing on field, you can use onkeyup() event as:

function check()

{

    var mobile = document.getElementById('mobile');

   

    

    var message = document.getElementById('message');

   var goodColor = "#0C6";

    var badColor = "#FF9B37";

  

    if(mobile.value.length!=10){

       

        mobile.style.backgroundColor = badColor;

        message.style.color = badColor;

        message.innerHTML = "required 10 digits, match requested format!"

    }}

And your HTML code should be:

<input name="mobile"  id="mobile" type="number" required onkeyup="check(); return false;" ><span id="message"></span>

Want to learn Java? Check out the Java certification from Intellipaat.

Browse Categories

...