jquery - How to Add Value Automatically After Submit Form -


for example have code input name="username" value="yoga" , id="username" not shown on form , added automatically when form sent.

what possible?

please use code.

<form id="test">      <input type="text" id="username" name="username">     <input id="button" type="submit" value="submit">  </form>  <script> $('#button').click(function() {    if ($("#username").val() =="") {     $('#username').val("yoga") &&        $('#test').submit();   } else {   alert ("access denied!!")     return false   } }); </script> 

if input filled out access denied , if left blank produce value of yoga.

you can use type="hidden" more perfect.

ks fiddle


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -