Disable And Enable Input Elements In A Div Block Using jQuery
How do I make an disable and enable input elements in a div block using jquery?
What is a disable and enable input elements in a div block using jquery? How do you make a disable and enable input elements in a div block using jquery? This script and codes were developed by Victor Yan on 05 January 2023, Thursday.
Disable And Enable Input Elements In A Div Block Using jQuery - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Disable And Enable Input Elements In A Div Block Using jQuery</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
</head>
<body> <div class='container'> <h2>Disable And Enable Input Elements In A Div Block Using jQuery</h2> <form id="pageForm"> <p> When you click the below checkbox, all the input elements in the div are disabled, if they are enabled and vice versa. </p> <p> Click to change: <input id="toggleElement" type="checkbox" name="toggle" onchange="toggleStatus()" /> </p> <div id="elementsToOperateOn"> This is our example div block. <br /> Sample Text Box: <input type="text" name="name" /> <br /> Sample Checkbox : <input type="checkbox" name="participate" /> <br/> Sample Radio : <input type="radio" name="bookEarly" /> <br /> Sample Select: <select name="sampleSelect"> <option>Option 1</option> <option>Option 2</option> </select> </div>
</form> <div style="margin-top: 20px;">Sponsored by <a onclick="window.open('https://www.solargalore.com.au')">Solar Galore</a></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Disable And Enable Input Elements In A Div Block Using jQuery - Script Codes JS Codes
$(document).ready(function() { handleStatusChanged();
});
function handleStatusChanged() { $('#toggleElement').on('change', function () { toggleStatus(); });
}
function toggleStatus() { if ($('#toggleElement').is(':checked')) { $('#elementsToOperateOn :input').attr('disabled', true); } else { $('#elementsToOperateOn :input').removeAttr('disabled'); }
}
Developer | Victor Yan |
Username | tipsoftheday |
Uploaded | January 05, 2023 |
Rating | 3 |
Size | 2,033 Kb |
Views | 12,144 |
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!
Name | Size |
HTML 5 Session Storage Example | 1,825 Kb |
A Pen by Victor Yan | 2,757 Kb |
Detect Enter Key Pressed Using jQuery event | 1,822 Kb |
Sample AngularJS app using controller | 2,294 Kb |
Using Javascript to calculate age | 2,538 Kb |
Bootstrap 3 button groups | 1,510 Kb |
Tooltip using jQuery UI | 2,124 Kb |
HTML 5 Canvas Example | 2,026 Kb |
Create inline help tips for your site with a bit of CSS | 2,229 Kb |
Testing for a Value in JavaScript Array | 1,914 Kb |
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!
Name | Username | Size |
Resize image | Happyhj | 1,892 Kb |
No Vacancy 404 CSS Only | Sethkontny | 0 Kb |
Vue.js Starter | Andymerskin | 1,268 Kb |
Calendar | Miroot | 2,033 Kb |
GLSL Hills | Ykob | 6,991 Kb |
12 DAYS OF XMAS | Proto78 | 2,313 Kb |
Expert Help | SinceSidSlid | 4,064 Kb |
Login with flip 3d animation | Mariusbalaj | 3,014 Kb |
Nested table email layout | Massimo-cassandro | 2,355 Kb |
IE flex collapse bug fix | Rowno | 2,678 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!