how to make input field required which is in Bootstrap Modal? [closed] - html

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Before submitting the form user would know that model fields all mandatory that he/she as to fill out first before submitting the form.

If you want to make required fields on a form, all you have to do is add required="required" in the <input> tags.
Doing this kind of custom message can only be done in the <input> tag, using the oninvalid attribute. Do this:
<input type="text" oninvalid="alert('Hey, you missed something on modal!')" required="required">

Related

how can I prevent a user to type 0 as the first character in a text input using vanilla javascript? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have this html block:
<div class="form-group flex-auto" >
<input maxlength="2" class="form-control format__itemForm" type="text" ng-model="$ctrl.codigoPaisTelefono" prevent-keys="{{ $ctrl.caracteresExcluidos }}"
required oninput="this.value== 0? this.value == '' :void(0)"
>
</div>
I need to prevent users to type 0 as the first character, I tried oninput method above, but didn't work.
Any clue?
Something like this maybe?
function validate(element){
var val = element.value;
if(val.charAt(0)=='0'){
element.value=val.substring(1, val.length);
}
}
<input oninput="validate(this)">

How to have multiple placeholders with different colors in HTML? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to make the text from a form input from the placeholder to be grey and for another input, white. How could i resolve this problem?
<input type="text" id="address" name="address" placeholder="...">
You need to use css:
In order to style a placeholder you need to write ::placeholder in the css line.
Because you need 2 different colors, give the input tag an id.
Then make the css using the id like this: #, then the id, and then the ::placeholder.
like this:
<input id="greyph" placeholder="...">
<input id="whiteph" placeholder="...">
<!-- ph = PlaceHolder -->
the css will be:
#greyph::placeholder {color: grey;}
#whiteph::placeholder {color: white;}
note that you don't have to color a placeholder to grey because this is the default

Transition between links using Tab - exclusion some links [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have page with main menu, some links in main content and left menu. The site must be adapted for the blind...
So, when I want to use tab buton to transition between links the order is:
Main menu
Content
Left menu
Is it possible to add some values to <a> tag to 'excluded' it?
You are supposed to add correct tabindex values for doing something like this. So, if you have such a requirement and you don't have the same HTML structure, you can use tabindex to modify the control flow.
Consider this example:
<input value="Last" tabindex="3" />
<input value="First" autofocus tabindex="1" />
<input value="Middle" tabindex="2" />
Now in the above fiddle, see how pressing Tab key affects the control. You can achieve similar if you can use tabindex.

What function does a submit button call? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to create my custom submit button. So I need to know what javascript function does the input type submit button call? I don't want a css customized submit button if possible.
In Case your HTML Looks like this:
<form id="myform" name="myform" action="destination.html">
<input id="sub_Button" type="button" value="clickme" onclick="mySubmitFunction();" />
</form>
Do you mean JavaScript?
document.myform.submit();
Or JQuery?
$("#myform").submit();

Why is onblur="trim()" used in input element? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
<input type="text" name="firstName" id="firstName" onblur="trim(document.TheForm.firstName)" value="" />
In the above element the why is attribute onblur="trim(document.TheForm.firstName)" used.
To remove trailing whitespace when you leave the field.
When a user leaves the input field firstName, the entered value is trimmed.