Simple jQuery Selector Class Change
How do I make an simple jquery selector class change?
What is a simple jquery selector class change? How do you make a simple jquery selector class change? This script and codes were developed by James Zedd on 09 January 2023, Monday.
Simple jQuery Selector Class Change - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple jQuery Selector Class Change</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <p class="foo foo-over"> This item ships for free!
</p>
<p class="foo foo-under"> Orders $50 or over will Ship for free!
</p>
<select id="price_selector"> <option value="over-50">Over $50</option> <option value="under-50">Under $50</option>
</select> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Simple jQuery Selector Class Change - Script Codes CSS Codes
.show {color: blue;}
.hide {color: red;}
Simple jQuery Selector Class Change - Script Codes JS Codes
$('.foo-over').addClass('show');
$('.foo-under').addClass('hide');
$('#price_selector').change(function(){ if ($('#price_selector').val() == 'over-50') { $('.foo-over').removeClass('hide').addClass('show'); $('.foo-under').removeClass('show').addClass('hide'); } else { $('.foo-over').removeClass('show').addClass('hide'); $('.foo-under').removeClass('hide').addClass('show'); }
});
Developer | James Zedd |
Username | james_zedd |
Uploaded | January 09, 2023 |
Rating | 3 |
Size | 1,802 Kb |
Views | 2,024 |
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 |
Responsive Multi-Column Table with Links | 4,956 Kb |
Simple Package Tier Display | 2,522 Kb |
CSS Menu Item Transition and Image Animation | 2,184 Kb |
HTML for IID | 1,792 Kb |
Modern Responsive Product Comparison Table | 2,952 Kb |
Modern Responsive Product Comparison Table for E-commerce | 2,538 Kb |
Flex | 2,796 Kb |
A Pen by James Zedd | 2,674 Kb |
Price | 3,043 Kb |
Responsive Advert | 2,354 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 |
CSS only simple parallax scroll | Stanssongs | 3,708 Kb |
Display properties | Hamzaerbay | 1,886 Kb |
SVG Playground | Roygwells | 1,834 Kb |
SVG Circle Progress | JMChristensen | 3,368 Kb |
Flat iOS 7 Safari Icon | Rss | 3,332 Kb |
Amazing CSS Menu with Notification Badges | Faizanasad | 2,549 Kb |
Twinner Spinner II | Katydecorah | 2,974 Kb |
Next Word Predictor | Rfalor | 2,776 Kb |
CSS3 Snow Animation | NickyCDK | 1,695 Kb |
Svg animation draw | SzymonDziewonski | 5,545 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!