Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to disable spaces and tabs for a input:text

var field = document.querySelector('[name="username"]');

field.addEventListener('keypress', function ( event ) {  
   var key = event.keyCode;
    if (key === 32) {
      event.preventDefault();
    }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: setstate before function react 
Javascript :: convert fetch promise to observable 
Javascript :: javascript only works in codepen 
Javascript :: gatsby markdown link blank 
Javascript :: spherical.computeheading javascript 
Javascript :: emit value from node server 
Javascript :: MAT_DIALOG_SCROLL_STRATEGY 
Javascript :: javscript explode by backticks 
Javascript :: 4.4.2.2. Good Variable Names¶ 
Javascript :: how to toglle button in viewjs 
Javascript :: jssor js slider next prev arrows position 
Javascript :: event pooling in react/event.persist/using async function in event callback 
Javascript :: 1update normalize-url 
Javascript :: corousal in react 
Javascript :: discord.js ban 
Javascript :: grommetjs remove green over buttons 
Javascript :: javascript reassignment 
Javascript :: browserify call bundeled function 
Javascript :: how to make a website send form to you 
Javascript :: validate date 
Javascript :: how to detech ctrl+C exist in nodejs 
Javascript :: settimeout react native focus text input 
Javascript :: js create element with attributes 
Javascript :: how we use usefef in map function 
Javascript :: js load inside div from file 
Javascript :: map for id 
Javascript :: how to detect clicks using javascript addeventlistener 
Javascript :: open screen pdf on google drive react native expo 
Javascript :: how to add types of a chance mixin 
Javascript :: jquery 1.6 jgrid pagging ejemplo 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =