How to Change Value of input field - html

I want to change the value of this input field. Can someone help please??
<input _ngcontent-c1="" class="margininput ng-untouched ng-pristine ng-invalid" id="empcode" name="EmpCode" ngmodel="" placeholder="EmpCode" required="" type="text" ng-reflect-required="" ng-reflect-name="EmpCode" ng-reflect-model="">

change the input type to whatever you want to change.
example:
<input type="number" placeolder="" name="">
<input type="text" placeolder="" name="">
<input type="password" placeolder="" name="">

Related

How to allow step in disabled input number

I want to have a disabled input number, but I want to be allowed to use the arrows to round it. How can I do it?
<input name="deroga" type="number" class="form-control" step=".01" value="127.05" disabled>
Thank you
<input name="deroga" type="number" class="form-control" step=".01" value="127.05" onkeydown="return false" >

How to make the input type="number" to not accept number with leading zeros?

This is my current code for the input field. How can I make it display a message saying that the number I've entered should not start with zero? thanks
<input type="number" min="10" max="1000" class="form-control" name="payment"
placeholder="enter payment" style="text-align:center" autofocus required/>
<br/>
For instance, typing 020 should not be accepted. Only numbers between 10 to 1000.
This should work:
<input type="text" class="form-control" name="payment"
placeholder="enter payment" style="text-align:center" autofocus required
pattern="[1-9]\d*" title="A number with no starting zeros"/>
https://jsfiddle.net/spL2par2/
try this using HTML's pattern attribute
<input type="number" class="form-control" name="payment"
placeholder="enter payment" style="text-align:center" pattern="[1-9]\d*" autofocus required/>
<br/>

html- input tag drop down not showing for previous entered values

My input tag in a form is not showing the suggestions for previous entered values
<form target="temp" method="post" action="">
<input id="UserID" name="UserID" type="text" placeholder="User ID" autocomplete="on" spellcheck="false">
<input id="Password" type="password" placeholder="Password" spellcheck="false">
<input type="button" value='Submit' onclick="login();">
</form>
What is happening is:
I want it to be:
You can make most browsers display values previously entered in input fields by giving a name to the input.
Change first input to this:
<input id="UserID" name="UserID" type="text" placeholder="User ID" spellcheck="false">
UPDATE
Not sure what your onClick function is doing but...
Change type="button" to type="submit":
<input type="submit" value='Submit' />

How to change the default message of the required field in the popover of form-control in bootstrap?

<form class="form-asd" role="form">
<h2 class="form-signin-heading">login</h2><hr />
<label class="control-label" for="username">Username</label>
<input class="form-control" type="email" required="" placeholder="username"data-error="enter username"></input>
<label class="control-label" for="username">password</label>
<input class="form-control" type="password" required=" " placeholder="Password"></input>
<label class="checkbox"></label>
<button class="btn btn-lg btn-primary " type="submit">submit</button>
</form>
how can we change this default message of popover of the require field "Please fill out this field "to "please enter username"
You can use setCustomValidity function when oninvalid event occurs.
Like below:-
<input class="form-control" type="email" required=""
placeholder="username" oninvalid="this.setCustomValidity('Please Enter valid email')">
</input>
Update:-
To clear the message once you start entering use oninput="setCustomValidity('') attribute to clear the message.
<input class="form-control" type="email" required="" placeholder="username"
oninvalid="this.setCustomValidity('Please Enter valid email')"
oninput="setCustomValidity('')"></input>
Combination of Mritunjay and Bartu's answers are full answer to this question. I copying the full example.
<input class="form-control" type="email" required="" placeholder="username"
oninvalid="this.setCustomValidity('Please Enter valid email')"
oninput="setCustomValidity('')"></input>
Here,
this.setCustomValidity('Please Enter valid email')" - Display the custom message on invalidated of the field
oninput="setCustomValidity('')" - Remove the invalidate message on validated filed.
And for all input and select:
$("input[required], select[required]").attr("oninvalid", "this.setCustomValidity('Required!')");
$("input[required], select[required]").attr("oninput", "setCustomValidity('')");
I wanted to change the text of the textarea. This method helped
<form action="/action_page.php" method="post">
<input type="text" required placeholder="username" oninvalid="this.setCustomValidity('Error validate')" oninput="setCustomValidity('')">
<br><br>
<textarea placeholder="Ko’cha, uy, xonadon" name="address" required oninvalid="this.setCustomValidity('Majburiy maydon')" oninput="setCustomValidity('')"></textarea>
<input type="submit" value="Submit">
</form>
$("input[required]").attr("oninvalid", "this.setCustomValidity('Say Somthing!')");
this work if you move to previous or next field by mouse, but by enter key, this is not work !!!

Changing value of hidden form with ID of text input forms with onfocus

How do you change the value of a hidden form with the id's of text forms? I have something like the following:
<form name="form" action="file.php" method="post">
<input type="hidden" name="dessert" id="dessert" value="">
Favorite cake: <input type="text" name="cake" id="cake" onfocus="dessert.value=this.id"><br>
Favorite pie: <input type="text" name="pie" id="pie" onfocus="dessert.value=this.id"><br>
Favorite taffy: <input type="text" name="taffy" id="taffy" onfocus="dessert.value=this.id"><br>
<input type="submit value="Go."><br>
I'm pretty unfamiliar with html, so I'm having trouble changing the value of the hidden form with the id of the text input onfocus.
Your code works, you just have a syntax error.
<input="hidden" name="dessert" id="dessert" value="">
Should be:
<input type="hidden" name="dessert" id="dessert" value="">
notice the "type="
Works in Chrome: fiddle
Try:
<form name="form" action="file.php" method="post">
<input type="hidden" name="dessert" id="dessert" value="">
Favorite cake: <input type="text" name="cake" id="cake" onfocus="document.getElementById('dessert').value=this.id"><br>
Favorite pie: <input type="text" name="pie" id="pie" onfocus="document.getElementById('dessert').value=this.id"><br>
Favorite taffy: <input type="text" name="taffy" id="taffy" onfocus="document.getElementById('dessert').value=this.id"><br>
<input type="submit value="Go."><br>​​​​​​​
Using the format:
onfocus="document.getElementById('dessert').value=this.id"
jsFiddle example