Palindrome Checker

Developer
Size
2,246 Kb
Views
8,096

How do I make an palindrome checker?

Just a bit of jQuery practice.Taken from http://www.dreamincode.net/forums/topic/78802-martyr2s-mega-project-ideas-list/. What is a palindrome checker? How do you make a palindrome checker? This script and codes were developed by Ajay Karwal on 26 December 2022, Monday.

Palindrome Checker Previews

Palindrome Checker - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Palindrome Checker</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Palindrome Tester</h1>
<p>Enter a word to see if it reads the same backwards as it does forwards</p>
<form class="form-inline" role="form"> <input id="wordInput" type="text" class="form-control" placeholder="Go on, enter a word"> <input id="checkWordButton" type="submit" value="Go" class="btn btn-primary">
</form>
<p id="result"></p> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Palindrome Checker - Script Codes CSS Codes

body {margin:20px}
#result { margin-top:20px; padding:10px; font-size:1.5em; }

Palindrome Checker - Script Codes JS Codes

var result = $("#result");
$("#checkWordButton").click(function(e) { e.preventDefault(); var wordForward = $("#wordInput").val().toLowerCase(); if (wordForward.length > 0) { checkWord(wordForward); } else { result.text("I said enter a word! Pay attention").addClass("bg-info"); }
});
function checkWord(word) { //alert(word); var word2 = word.split('').reverse().join(''); if (word == word2) { result.text("Well done, '"+ word +"' is a Palindrome. You win.").removeClass().addClass("bg-success"); } else { result.text("Nope. '"+ word +"' is not a Palindrome. Try again.").removeClass().addClass("bg-warning"); }
};
Palindrome Checker - Script Codes
Palindrome Checker - Script Codes
Home Page Home
Developer Ajay Karwal
Username ajaykarwal
Uploaded December 26, 2022
Rating 3
Size 2,246 Kb
Views 8,096
Do you need developer help for Palindrome Checker?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Ajay Karwal (ajaykarwal) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!