Jquery form

Developer
Size
2,920 Kb
Views
52,624

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 Previews

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'); }
});
Jquery form - Script Codes
Jquery form - Script Codes
Home Page Home
Developer Rob
Username rowinf
Uploaded August 30, 2022
Rating 3
Size 2,920 Kb
Views 52,624
Do you need developer help for Jquery form?

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!

Rob (rowinf) 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!