Jquery form
How do I make an jquery form?
Simple form with jquery validation. The Submit button is invalid until the form is in a valid state. This was created based on a customer requirement from one of my old projects.. What is a jquery form? How do you make a jquery form? This script and codes were developed by Rob on 30 August 2022, Tuesday.
Jquery form - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>jquery form</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <form class="form"> <div class="picker-panel"> <select id="state-picker"> <option value="">-- Select a State --</option> <option value="OH">Ohio</option> <option value="CA">California</option> <option value="HI">Hawaii</option> <option value="TX">Texas</option> </select> <select id="city-picker" disabled="true"> <option value="">-- Select City --</option> </select> </div> <div class="choice-panel"> <label class="radio-button"> <input type="radio" name="opinion-group" value="never-been" checked="true"/> Never Been There </label> <label class="radio-button"> <input type="radio" name="opinion-group" value="have-been"/> Been There </label> <label class="radio-button"> <input type="radio" name="opinion-group" value="lived-there"/> Lived There </label> </div> <div class="options-panel"> <label class="checkbox"> <input type="checkbox" name="choice" value="scuba" disabled="disabled" /> Scuba </label> <label class="checkbox"> <input type="checkbox" name="choice" value="hiking" disabled="disabled" /> Hiking </label> <label class="checkbox"> <input type="checkbox" name="choice" value="pub-crawl" disabled="disabled" /> Pub Crawl </label> </div> <div class="button-panel"> <button id="submit-button" disabled="disabled">Submit</button> <button id="reset-button">Reset</button> </div>
</form> <script src="js/index.js"></script>
</body>
</html>
Jquery form - Script Codes CSS Codes
@import url(http://fonts.googleapis.com/css?family=Roboto);
body {
}
button, label, select { font-size: 14px; font-family: 'Roboto', sans-serif; color: #242568;
}
label { margin-bottom: 5px;
}
.form { width: 220px; background-color: #f1c4cc; padding: 10px; border-radius: 8px; background-image: linear-gradient(bottom, rgb(255, 149, 0) 0%, rgb(255, 192, 65) 100%); background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, rgb(255, 149, 0)),color-stop(1, rgb(255, 192, 65))); margin: auto;
}
.picker-panel {
}
.picker-panel select { display: block; margin-bottom: 6px; width: 220px;
}
.choice-panel label,
.options-panel label{ display: block; line-height: 20px;
}
.options-panel label { margin-left: 20px;
}
.button-panel { text-align: right;
}
Jquery form - Script Codes JS Codes
// states with corresponding cities
var stateCities = { 'CA' : ['Los Angeles','San Francisco','San Diego'], 'OH' : ['Dayton', 'Cincinnati', 'Columbus'], 'HI' : ['Honolulu','Mauna Loa','Waikiki'], 'TX' : ['Austin','Dallas','San Antonio']
};
// if someone picks a state from the state list
// populate the city dropdown with the names of cities from that state
$('#state-picker').change(function() { $('#city-picker').children().remove(); $('#city-picker').append('<option value="">-- Select City --</option>'); var state = $(this).val(); if(!state) { $('#city-picker').attr('disabled','disabled'); $('#submit-button').attr('disabled','disabled'); return false; } $('#city-picker').removeAttr('disabled'); for (city in stateCities[state]) { $('#city-picker').append('<option value="' + stateCities[state][city] + '">' + stateCities[state][city] + '</option>'); }
});
$('#city-picker').change(function() { if(!$(this).val()) { $('#submit-button').attr('disabled','disabled'); } else { $('#submit-button').removeAttr('disabled'); }
});
// reset the form
$('#reset').click(function() { $('#city-picker').val('').attr('disabled',true); $('#state-picker').val('');
});
// enable the checkboxes if 'Lived There' is selected, otherwise disable them
$('.choice-panel input').click(function() { if($(this).val() === "lived-there") { console.log('I lived somewhere'); $('.options-panel input').removeAttr('disabled'); } else { console.log('I didnt live there'); $('.options-panel input').attr('disabled','disabled'); }
});
Developer | Rob |
Username | rowinf |
Uploaded | August 30, 2022 |
Rating | 3 |
Size | 2,920 Kb |
Views | 52,624 |
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 |
A Pen by Rob | 1,972 Kb |
Flash Cards | 3,086 Kb |
A Pen by Rob | 3,452 Kb |
Get combo box item value | 1,981 Kb |
Table filters | 1,727 Kb |
D3 test | 2,395 Kb |
Foundation Off-Canvas menu test | 2,424 Kb |
JQuery Animations | 3,190 Kb |
Bootstrap test | 1,906 Kb |
Jquery form | 2,920 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 |
Atom | Bhlaird | 1,932 Kb |
SVG Text Masking | JMChristensen | 2,141 Kb |
Resizable SASS Icons | Marianarlt | 7,611 Kb |
Super Discount | Orrinward | 3,225 Kb |
Ocean | Gordonnl | 2,817 Kb |
Navcube | Wbarlow | 4,775 Kb |
Video mute | Leon9208 | 2,131 Kb |
Buttons for autumn | Nikazawila | 1,795 Kb |
Parallax with only CSS | Thulioph | 2,297 Kb |
Parallax scrolling scene | Iharosi | 2,485 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!