Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to remove space in input fiels

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<form>
<input placeholder="Enter Your Text" type="text" onkeypress="return AvoidSpace(event);" onblur="this.value=removeSpaces(this.value);">


</form>


/* Not Allow Spcace Type in textbox */
function AvoidSpace(event) {
    var k = event ? event.which : window.event.keyCode;
    if (k == 32) return false;
}

/* Remove Blank Space Automatically Before, After & middle of String */

function removeSpaces(string) {
 return string.split(' ').join('');
}

Comment

how to remove space in input field html

let input = document.getElementsByName("my_input")[0];
let val = input.value.replace(/s/g, "");
alert(val);
Comment

PREVIOUS NEXT
Code Example
Javascript :: href="javascript:void(null);" 
Javascript :: javascript break with for Loop 
Javascript :: how to convert array into string in js 
Javascript :: reset select form jquery 
Javascript :: laravel return validation errors ajax 
Javascript :: return elemnt from array 
Javascript :: how to change size of image js 
Javascript :: moment js check if date is greater than 
Javascript :: styling element using jquery 
Javascript :: append a query string to the url react 
Javascript :: hover effect in material ui 
Javascript :: change index array javascript 
Javascript :: merge 2 dictionaries with same keys javascript 
Javascript :: how to find length of a assocative array vuejs 
Javascript :: picker change event react native 
Javascript :: convert days into year month 
Javascript :: how to make @click in router-link vuejs 
Javascript :: iterate through object array javascript 
Javascript :: async await mongoose connection 
Javascript :: laravel react 
Javascript :: how to slice/trim/remove last character in string 
Javascript :: regular expressions password contains number 
Javascript :: how to add important tag js 
Javascript :: datatable numbering 
Javascript :: what is cdn react 
Javascript :: Loop over all keys in the local storage 
Javascript :: detect if two line segments intersect each other javascript 
Javascript :: using dto in node js 
Javascript :: node how to stop NodeJS server process 
Javascript :: javascript add text to li 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =