简体   繁体   中英

getting trouble with .value in javascript

JS

function validate() {
    var cb = document.getElementById("cmbs").value; alert=(cb);
}

HTML

<form method="POST" action="" onsubmit="return validate()">          

    <label>company/business name</label><br>       
    <input type="text" name="companybusiness_name" placeholder="company/business Name" class="form-control" autocomplete="off" id="cmbs" value="">
</form>

 function validate() { var cb = document.getElementById("cmbs").value; alert(cb) }
 <form method="POST" action="" onsubmit="return validate()"> <label>company/business name</label><br> <input type="text" name="companybusiness_name" placeholder="company/business Name" class="form-control" autocomplete="off" id="cmbs" value=""> <button type="sumbit"> ok </button> </form>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM