For example I have a code input name="username"
with value="Yoga"
and id="username"
but it was not shown on the form and will be added automatically when the form is sent.
What this possible?
For example I have a code input name="username"
with value="Yoga"
and id="username"
but it was not shown on the form and will be added automatically when the form is sent.
What this possible?
Please use this 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 the input will be filled out Access Denied and if left blank will produce a value of Yoga.
You can also use type="hidden" for a more perfect.