'jquery get multiple values from input , and take value after pressing "Enter button" without using onclick button
I'm trying to make the user input more than one phone number after pressing enter
<div class="col-lg-3">
<label for="txt_phone_numbers">
Phone Numbers:
</label>
<input id="txt_phone_numbers" class="form-control" multiple>
</div>
Solution 1:[1]
You can try something like this, when entering something into your input box, it waits for the enter button to be pressed, then you can get whats been entered and do whatever you need to, you have not made it clear when you say more than one number? Do you mean get that number, save it, clear the input and wait for another? Easy enough, I suggest you store them in an array.
$(document).on("keypress", "input", function(e) {
if (e.which == 13) {
var inputVal = $(this).val();
}
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
