How to add javascript into php?

Here is my js code

<script>
function myform() {
    var n = document.getElementById("name").value;

    if (n == "") {
        document.getElementById("username").innerHTML = "Please enter your name";
        return false;
    }
    if (!isNaN(n)) {
        document.getElementById("username").innerHTML = "Please enter valid name";
        return false;
    }
}
</script>

How to write this js code into php

m trying all code in echo but not working plz help

after php echo using

    echo'<script>
function myform() {
    var n = document.getElementById("name").value;

    if (n == "") {
        document.getElementById("username").innerHTML = "Please enter your name";
        return false;
    }
    if (!isNaN(n)) {
        document.getElementById("username").innerHTML = "Please enter valid name";
        return false;
    }
}
</script>';

thankyou



from Recent Questions - Stack Overflow https://ift.tt/3iYHgzu
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept