Skip to content

Instantly share code, notes, and snippets.

View yashasvi9199's full-sized avatar

Yash Haldiya yashasvi9199

View GitHub Profile
@yashasvi9199
yashasvi9199 / WordRank Scoring System.jsp
Created July 25, 2023 09:44
Create a function that takes a string of words and returns the highest scoring word. Each letter of a word scores points according to it's position in the alphabet: a = 1, b = 2, c = 3, etc.
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<h3>Please enter a string !</h3>
</br>
@yashasvi9199
yashasvi9199 / Check function Execution.jsp
Created July 13, 2023 16:21
Check if the function has already been executed
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<button id="first">Click Me Once!</button>
<script>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<script>
$(document).ready(function() {
var input = [];
for (var i = 0; i < 2; i++) {
if (i == 0) input[i] = prompt("Please enter dividend Number");
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<h3>Enter your Age</h3>
<input type="number" id="age" />
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</head>
<body>
<h3>Enter minutes</h3>
<input type="number" id="hell" />
@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()" />
@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 / 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 / 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 / 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