html - How to see if input contain some value? -


i've form this:

<form action="#" method="post">     <input type="text" name="website" /> </form> 

how can find if user enter website http:// or without? want show in:

<a href="value input"> 

any suggestions how validate form , send database right link like: http://website...?

you may use javascript validate input.

function validate()  {    var input = document.getelementsbyname("website")[0].value;    if(input.startswith("http://")) {        alert("valid input");        return true;    }       alert("invalid input");    return false;        }
<form action="#" method="post" onsubmit="return validate()">      <input type="text" name="website" />      <input type="submit" />  </form>


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -