Skip to content

Instantly share code, notes, and snippets.

View yashasvi9199's full-sized avatar

Yash Haldiya yashasvi9199

View GitHub Profile
@yashasvi9199
yashasvi9199 / index.jsp
Created March 9, 2023 08:26
Amount Validation
<!DOCTYPE html>
<html>
<head>
<title>Amount Validation</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
@yashasvi9199
yashasvi9199 / date_Reverse.jsp
Created March 9, 2023 10:06
Reverse Date with string in beginning, middle, end
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<input type="date" id="fromDate">
<input type="date" id="toDate">
@yashasvi9199
yashasvi9199 / Radio_validation.jsp
Created March 9, 2023 11:51
Radio buttons where every button have name& id as same
<html>
<head>
<title>Radio button selection</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<input type="radio" name="myrd" id="myrd" value="phone">Phone
<input type="radio" name="myrd" id="myrd" value="email">Email
@yashasvi9199
yashasvi9199 / remove_arrow.css
Created March 10, 2023 06:02
CSS to disable arrows from numberfield
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
@yashasvi9199
yashasvi9199 / inputRestrictions.js
Created June 6, 2023 07:06
Restrict special character and space in Input field
function userValidation(val,event) {
var k = event ? event.which : window.event.keyCode;
var len = val.length;
if (len == 0 && k == 32){
return false;
}
//Restrict spacial character
// 45 = hyphen (-), 46 = fulls top (.), 95 = underscore (_), 48-57 = 0-9, 65-90 = Uppercase alphabets 97-122 = Lowercase alphabets
@yashasvi9199
yashasvi9199 / restrict_Another_Space.jsp
Created June 7, 2023 16:13
This will allow user to input only restricted number of space
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<h2>Please Enter Input</h2>
<input type="text" placeholder="Enter input" onkeypress="return restrict(this.value,event)">
@yashasvi9199
yashasvi9199 / trimmer.jsp
Created June 7, 2023 16:23
Trim space from beginning and end in input text field
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<h2>Please Enter Input</h2>
<input type="text" placeholder="Enter input" onblur="trimmer(this.value)">
@yashasvi9199
yashasvi9199 / JSON Object Validation.jsp
Created June 15, 2023 13:54
Use JSON object in simplofied way to find if the object have required properties using hasOwn function of jquery
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<form>
<input type="text" placeholder="Enter First Name" id="fname" readonly>
</br>
@yashasvi9199
yashasvi9199 / Search dynamic elements in array.jsp
Created July 13, 2023 08:28
Search elements in array that has been dynamically set by user. User can either search element by index or by its values
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<h1>Please enter elements for the array</h1>
<br>
<input type="number" id="num" max="9" onchange="run()" />