Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

input will get only number vue

 <input @keypress="onlyNumber" type="text">

onlyNumber ($event) {
   //console.log($event.keyCode); //keyCodes value
   let keyCode = ($event.keyCode ? $event.keyCode : $event.which);
   if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) { // 46 is dot
      $event.preventDefault();
   }
}
Comment

number only input vue

<div id="demo">
  <input v-model="message" @keypress="isNumber($event)">
</div>
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript get table row count 
Javascript :: blacklisted word discord.js 
Javascript :: jquery script tag 
Javascript :: js is object empty 
Javascript :: integer to roman javascript 
Javascript :: get the first day and last day of current mongth javascript 
Javascript :: math random equitative js 
Javascript :: how to run a vue js hello world app in vue version 3 
Javascript :: jquery disable class attribute 
Javascript :: text number of lines react native 
Javascript :: pass url params to child router express 
Javascript :: update nodejs 
Javascript :: javascript check if blank space 
Javascript :: how to add react icons using npm 
Javascript :: how to remove modal-backdrop fade in jquery 
Javascript :: godot destroy node 
Javascript :: leaflet.js cdn 
Javascript :: jquery open a new tab 
Javascript :: make minutes have 0 in javascript 
Javascript :: react native flatlist horizontal scroll 
Javascript :: token invalid discord bot 
Javascript :: Hide a div on clicking outside it with jquery 
Javascript :: how to remove cors error from node app 
Javascript :: javascript disable scrolling on body 
Javascript :: react native android build 
Javascript :: jquery if checkbox checked 
Javascript :: get values form query params in next js 
Javascript :: react native text wrap 
Javascript :: settimeout es6 
Javascript :: us states js array 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =