JQuery fallback for placeholder

Developer
Size
2,044 Kb
Views
6,072

How do I make an jquery fallback for placeholder?

What is a jquery fallback for placeholder? How do you make a jquery fallback for placeholder? This script and codes were developed by Asakasinsky on 27 December 2022, Tuesday.

JQuery fallback for placeholder Previews

JQuery fallback for placeholder - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>jQuery fallback for placeholder</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <input type="text" placeholder="Enter =>"> <script src="js/index.js"></script>
</body>
</html>

JQuery fallback for placeholder - Script Codes CSS Codes

body { margin: 5% auto; background: #fff; }
input { font-size: 44px; padding: 20px; font-family: courier; font-weight: bold; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; border: 4px solid rgba(0,0,0,.15); display: block; margin: 50px auto; width: 80%; background: rgba(255,255,255,0.9); overflow: hidden; text-overflow: ellipsis;
}
input:focus { outline: 0; border: 4px solid rgba(0,0,0,.3); -webkit-box-shadow: 0 0 10px rgba(0,0,0,.3);
}

JQuery fallback for placeholder - Script Codes JS Codes

$(document).ready(function() { if ( !("placeholder" in document.createElement("input")) ) { $("input[placeholder], textarea[placeholder]").each(function() { var val = $(this).attr("placeholder"); if ( this.value == "" ) { this.value = val; } $(this).focus(function() { if ( this.value == val ) { this.value = ""; } }).blur(function() { if ( $.trim(this.value) == "" ) { this.value = val; } }) }); // Clear default placeholder values on form submit $('form').submit(function() { $(this).find("input[placeholder], textarea[placeholder]").each(function() { if ( this.value == $(this).attr("placeholder") ) { this.value = ""; } }); }); }
});
JQuery fallback for placeholder - Script Codes
JQuery fallback for placeholder - Script Codes
Home Page Home
Developer Asakasinsky
Username asakasinsky
Uploaded December 27, 2022
Rating 3
Size 2,044 Kb
Views 6,072
Do you need developer help for JQuery fallback for placeholder?

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!

Asakasinsky (asakasinsky) Script Codes
Create amazing SEO content 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!