Select Previous Value of Dropdown on Custom Click Button
How do I make an select previous value of dropdown on custom click button?
Select Previous Value of Dropdown on Custom Click Button. What is a select previous value of dropdown on custom click button? How do you make a select previous value of dropdown on custom click button? This script and codes were developed by Ahsan K. Rathore on 04 July 2022, Monday.
Select Previous Value of Dropdown on Custom Click Button - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Select Previous Value of Dropdown on Custom Click Button</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h3>Select Previous Value of Dropdown on Custom Click Button</h3>
<select id="DateFilterDropdown"> <option value="choose">Choose Date</option> <option value="today">Today</option> <option value="yesterday">Yesterday</option> <option value="thisWeek">This Week</option> <option value="thisMonth">This Month</option> <option value="custom">Custom</option>
</select>
<div id="today" class="content"> <a href="javascript:void(0)" class="content-close" onclick="RestorePreviousOption(this);">Close</a> <h1 class="content-heading">Today Data</h1>
</div>
<div id="yesterday" class="content"> <a href="javascript:void(0)" class="content-close" onclick="RestorePreviousOption(this);">Close</a> <h1 class="content-heading">Yesterday Data</h1>
</div>
<div id="thisWeek" class="content"> <a href="javascript:void(0)" class="content-close" onclick="RestorePreviousOption(this);">Close</a> <h1 class="content-heading">This Week Data</h1>
</div>
<div id="thisMonth" class="content"> <a href="javascript:void(0)" class="content-close" onclick="RestorePreviousOption(this);">Close</a> <h1 class="content-heading">This Month Data</h1>
</div>
<div id="custom" class="content"> <a href="javascript:void(0)" class="content-close" onclick="RestorePreviousOption(this);">Close</a> <h1 class="content-heading">Custom Data</h1> <div class="custom-date-picker-popup"> <div class="date-span"> <span class="label">From Date</span> <span class="field"> <input type="text"> <span class="error">*From date cannot be empty</span> </span> </div> <div class="date-span"> <span class="label">End Date</span> <span class="field"> <input type="text"> <span class="error">*End date cannot be empty</span> </span> </div> <div class="date-span"> <span class="label"></span> <span class="field"> <input type="button" value="Done"> <input type="button" value="Cancel" onclick="RestorePreviousOption(this);"> </span> </div> </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>
Select Previous Value of Dropdown on Custom Click Button - Script Codes CSS Codes
body{ font-family: tahoma; font-size: 16px;
}
#DateFilterDropdown { padding: 10px; border-radius: 2px; font-size: 16px; /* Comment */
}
.content { border: 1px solid #ccc; padding: 15px; margin-top: 15px; display: none;
}
.content-heading { display: block; margin-right: 100px; font-size: 16px; font-weight: normal; padding:0px; margin: 0px;
}
a:hover{text-decoration: underline;}
.content-close { width: 100px; float: right; display: block; text-align: right; text-decoration:none; color: royalblue;
}
.custom-date-picker-popup { background-color: #e4e4e4; padding: 25px; margin-top: 50px; width: 300px; margin: 0 auto;
}
.date-span { display: block; font-size: 14px; font-family: tahoma; overflow: hidden; margin-bottom: 10px;
}
.date-span span.label { width: 100px; text-align : right; float: left; line-height: 27px; display: block;
}
.date-span span.field { display: block; margin-left: 110px;
}
.date-span span.field input[type=text] { width : 135px; padding: 5px 10px; display: block;
}
.date-span span.field span.error { display: none; color: red; font-size: 12px; margin-left: 0px; padding: 5px 0; width: 100%;
}
Select Previous Value of Dropdown on Custom Click Button - Script Codes JS Codes
var oldDropdownValue = 'choose';
$('#DateFilterDropdown').on('mousedown', function() { var newddlval = $(this).val(); oldDropdownValue = newddlval;
});
$('#DateFilterDropdown').on('change', function() { var ddlvalue = $(this).val(); $('.content').hide(); $("#" + ddlvalue).fadeIn(300);
});
function RestorePreviousOption(el) { var elmVal = $(el).parent().attr('id'); if(oldDropdownValue == elmVal) { $('#DateFilterDropdown').val('choose'); $('.content').hide(); } else { $('#DateFilterDropdown').val(oldDropdownValue); $('.content').hide(); $("#" + oldDropdownValue).fadeIn(300); }
}
Developer | Ahsan K. Rathore |
Username | ahsanrathore |
Uploaded | July 04, 2022 |
Rating | 3 |
Size | 2,690 Kb |
Views | 36,432 |
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 |
Shopping Cart - Angular JS | 3,835 Kb |
SVG Radio Wave Alerts Animation | 1,633 Kb |
Google Map Customized InfoWindow Hack | 3,727 Kb |
One page responsive website By Ahsan Khurshid | 6,327 Kb |
SVG Path Animation using CSS3 | 5,961 Kb |
Calculator UI | 2,644 Kb |
Product Dashboard Initial Layout | 3,376 Kb |
Password Strength | 2,929 Kb |
A Pen by Ahsan K. Rathore | 2,027 Kb |
Get a Quote Widget for Taxi Services in UK | 3,746 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 |
VerbalExpressions Converter | Cmalven | 2,607 Kb |
Mega Menu by Joni | Asakasinsky | 3,171 Kb |
Improve | Gavra | 1,652 Kb |
Simple content swap | Snografx | 1,859 Kb |
Light Switch | Bartuc | 4,933 Kb |
Portfolio Landing Page | FDfranklin | 3,585 Kb |
CSS Colors | Alexpate | 2,232 Kb |
Stylize Stories | Jvhti | 2,465 Kb |
Twinner Spinner II | Katydecorah | 2,974 Kb |
Cant get enough icecream in pure css3 | Melawire | 4,322 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!