JavaScript Display text in number input (associated to value) display number text,display text and number matlab,display text

Let's say I have a number input with only a few possible values like the following :

<label for="test" translate="entities.test"></label>
<input id="test" name="test" type="number" min="1" max="4" [(ngModel)]="model.test" class="form-control" [disabled]="isDisabled()" formControlName="test">

I wish to keep the numeric value but display some text for each value like :

"1 - High"

"2 - Medium"

"3 - Low"

"4 - Negligible"

Instead of just the number in the input.

Is this doable?

Or do I necessarily need to use a text input with a pattern restriction to limit the input to integers between 1 and 4 and then convert the value from text to number before sending it to my backend

Answer:1

You can use the list attribute on the input like below

<input id="test" name="test" type="number" min="1" max="4" [(ngModel)]="model.test" class="form-control" [disabled]="isDisabled()" formControlName="test" list="severity">
<datalist id="severity">
    <option value="1"> High</option>
    <option value="2"> Medium</option>
    <option value="3"> Low </option>
    <option value="4"> Negligible</option>
</datalist>
Answer:2

I am trying to write postgre puppet AST query in java script/coffee script, but I am not able to figure out how to send data (curl -d) through a GET request in java/coffree scripts. Can anyone help? ...

I am trying to write postgre puppet AST query in java script/coffee script, but I am not able to figure out how to send data (curl -d) through a GET request in java/coffree scripts. Can anyone help? ...

  1. send data javascript to php
  2. send data javascript
  3. send data javascript to html
  4. send data javascript to python
  5. send data javascript ajax
  6. send data javascript to java
  7. send data javascript to c#
  8. send data javascript swift
  9. javascript send data to node js
  10. send javascript data to server
  11. send data from javascript to django
  12. send data from javascript to python flask
  13. send form data javascript
  14. send data from javascript to servlet
  15. send post data javascript
  16. send data from javascript to python django
  17. send data onclick javascript
  18. send data from javascript to flask
  19. send data from javascript to node js
  20. send data from javascript to php using ajax

How can I get the option in a dropdownlist based off of the value that is selected? Essentially I want to get the option that is selected and then change the innerHTML. Here is what I have so far.. ...

How can I get the option in a dropdownlist based off of the value that is selected? Essentially I want to get the option that is selected and then change the innerHTML. Here is what I have so far.. ...

  1. javascript option from array
  2. javascript option from select
  3. javascript option on change
  4. javascript option on click
  5. javascript option for
  6. javascript option by value
  7. javascript option in multiple select
  8. javascript remove option from select
  9. javascript delete option from select
  10. javascript select option from dropdown
  11. javascript get option from select
  12. javascript remove option from dropdown
  13. javascript hide option from select
  14. javascript remove option from select list
  15. javascript choose option from dropdown
  16. javascript select option from array
  17. javascript delete option from dropdown
  18. javascript select option from value
  19. javascript add option from select
  20. javascript disable option from select

My method accepts an http.ServerResponse and calls some methods on it. Looking at Sinon's docs it appears that this should be trivial. however, I either get TypeError: response.writeHead is not a ...

My method accepts an http.ServerResponse and calls some methods on it. Looking at Sinon's docs it appears that this should be trivial. however, I either get TypeError: response.writeHead is not a ...

I'm following a course of learning Javascript, saw this code but don't know exactly how it works. Basically what it does is reverse the numbers in the array. Anyone who has a deeper understanding and ...

I'm following a course of learning Javascript, saw this code but don't know exactly how it works. Basically what it does is reverse the numbers in the array. Anyone who has a deeper understanding and ...

  1. reverse array with recursion
  2. reverse array with pointers
  3. reverse array with for loop
  4. reverse array with pointers c
  5. reverse array with map
  6. reverse array with recursion in c
  7. reverse array with javascript
  8. reverse array with foreach
  9. reverse array with function
  10. reverse array with java
  11. reverse array with
  12. reverse array with php
  13. reverse array with int
  14. array reverse with keys php
  15. array reverse with keys
  16. reverse array in c
  17. reverse array in groups
  18. reverse array in python
  19. reverse array in js
  20. reverse array in place