What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-13 05:05:08
javafx textfield only numbers
// force the field to be numeric only textField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { ... Add solution -
TypeScript 2021-11-04 00:23:06
angular numbers only directive
import { Directive, ElementRef, HostListener, Input } from '@angular/core'; import { NgControl } from '@angular/forms'; @Directive({ selector: 'input[type=number], input[numbersOnly]' }) export class NumbersOnlyInputDirective { constructor(private e... Add solution -
Javascript 2021-09-30 21:32:03
input field take only number and one comma
function checkKey() { var clean = this.value.replace(/[^0-9,]/g, "") .replace(/(,.*?),(.*,)?/, "$1"); // don't move cursor to end if no change if (clean !== this.value) this.value = clean; } // d... Add solution -
Other 2021-09-29 13:39:02
Function that replaces character and allow only numbers into the textbox
This technique we can use on the onkeyup property of HTML element <input type="text" id="txtMobileNo" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" Add solution
Best helpers
Ranking is empty