HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Yash Gohel</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="css/form.css">
<script src="https://kit.fontawesome.com/d07270b209.js" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.7.1.js"
integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
<script src="js/script.js"></script>
</head>
<body>
<div class="container width my-5 px-5">
<form class="form-control form-control-sm px-3">
<h5 class="pt-3 title">Welcome to Campaign</h5>
<p>Get Started</p>
<div class="input-group py-2">
<span class="input-group-text bg-white"><i class="fa-solid fa-user"></i></span>
<input type="text" class="form-control" id="userName" placeholder="User name" required>
</div>
<small id="user-error" class="form-text text-danger">
</small>
<div class="input-group py-2">
<span class="input-group-text bg-white"><i class="fa-solid fa-envelope"></i></span>
<input type="email" class="form-control" id="email" placeholder="Email" required>
</div>
<small id="email-error" class="form-text text-danger">
</small>
<div class="input-group py-2">
<span class="input-group-text bg-white"><i class="fa-solid fa-lock"></i></span>
<input type="password" class="form-control" id="password" placeholder="Password" required>
</div>
<small id="password-error" class="form-text text-danger">
</small>
<div class="input-group py-2">
<span class="input-group-text bg-white"><i class="fa-solid fa-lock"></i></span>
<input type="password" class="form-control" id="confirm-password" placeholder="Confirm" required>
</div>
<small id="confirm-password-error" class="form-text text-danger">
</small>
<div class="input-group py-2">
<span class="input-group-text bg-white"><i class="fa-solid fa-clipboard"></i></span>
<input type="text" class="form-control" id="oneliner" placeholder="An one liner about yourself"
required>
</div>
<small id="oneliner-error" class="form-text text-danger">
</small>
<div class="input-group py-2">
<span class="input-group-text bg-white"><i class="fa-solid fa-user"></i></span>
<input type="text" class="form-control" id="first-name" placeholder="First name" required>
</div>
<small id="first-name-error" class="form-text text-danger">
</small>
<div class="input-group py-2">
<span class="input-group-text bg-white"><i class="fa-solid fa-user"></i></span>
<input type="text" class="form-control" id="last-name" placeholder="Last name" required>
</div>
<small id="last-name-error" class="form-text text-danger">
</small>
<div class="input-group py-2">
<span class="input-group-text bg-white"><i class="fa-solid fa-user"></i></span>
<textarea id="about" class="form-control" placeholder="About yourself" required></textarea>
</div>
<small id="about-error" class="form-text text-danger">
</small>
<h5 class="mt-3 mb-4">What is Your Favourite fruit?</h5>
<div class="row">
<div class="col-3 form-check mx-5">
<input class="form-check-input" type="radio" name="fruits" value="apple" id="apple" required>
<label class="form-check-label" for="apple">
Apple
</label>
</div>
<div class="col-3 form-check mx-5">
<input class="form-check-input" type="radio" name="fruits" value="orange" id="orange" required>
<label class="form-check-label" for="orange">
Orange
</label>
</div>
<div class="col-3 form-check mx-5">
<input class="form-check-input" type="radio" name="fruits" value="strawberry" id="strawberry"
required>
<label class="form-check-label" for="strawberry">
Strawberry
</label>
</div>
<div class="col-3 form-check mx-5">
<input class="form-check-input" type="radio" name="fruits" value="banana" id="banana" required>
<label class="form-check-label" for="banana">
Banana
</label>
</div>
<small id="radio-error" class="form-text text-danger">
</small>
</div>
<h5 class="mt-4">Which movies do you like?</h5>
<p>Select all of them because it is tough for you...</p>
<div class="row">
<div class="col-3 form-check mx-5">
<input class="form-check-input" type="checkbox" value="3-Idiots" id="3-idiots">
<label class="form-check-label" for="defaultCheck1">
3 Idiots
</label>
</div>
<div class="col-3 form-check mx-5">
<input class="form-check-input" type="checkbox" value="KGF" id="kgf">
<label class="form-check-label" for="defaultCheck1">
KGF
</label>
</div>
<div class="col-3 form-check mx-5">
<input class="form-check-input" type="checkbox" value="Bahubali" id="bahubali">
<label class="form-check-label" for="defaultCheck1">
Bahubali
</label>
</div>
<div class="col-3 form-check mx-5">
<input class="form-check-input" type="checkbox" value="Dangal" id="dangal">
<label class="form-check-label" for="defaultCheck1">
Dangal
</label>
</div>
<small id="checkbox-error" class="form-text text-danger">
</small>
<h5 class="mt-4">Please rate our website</h5>
<h6 class="mt-3 mb-3">Design</h6>
<div class="d-flex flex-wrap d-star">
<div class="mx-3">Worst</div>
<i class="fa-regular mx-1 fa-star" id="d1"></i>
<i class="fa-regular mx-1 fa-star" id="d2"></i>
<i class="fa-regular mx-1 fa-star" id="d3"></i>
<i class="fa-regular mx-1 fa-star" id="d4"></i>
<i class="fa-regular mx-1 fa-star" id="d5"></i>
<div class="mx-3">Best</div>
</div>
<small id="design-output" class="form-text text-danger mb-4"></small>
<hr />
<h6 class=" mb-3">Information</h6>
<div class="d-flex flex-wrap i-star">
<div class="mx-3">Worst</div>
<i class="fa-regular mx-1 fa-star" id="i1"></i>
<i class="fa-regular mx-1 fa-star" id="i2"></i>
<i class="fa-regular mx-1 fa-star" id="i3"></i>
<i class="fa-regular mx-1 fa-star" id="i4"></i>
<i class="fa-regular mx-1 fa-star" id="i5"></i>
<div class="mx-3">Best</div>
</div>
<small id="info-output" class="form-text text-danger"></small>
<button id="submitBtn" class="btn btn-success border-0 mt-3">Submit</button>
</div>
</form>
</div>
<div class="container my-5 px-5">
<h5 class="pt-3 title">All data goes here as output</h5>
<div class="row mt-3">
<div class="col-md-12">
<div class="table-responsive card bg-success">
<table class="table table-bordered table-hover table-striped" id="table">
<thead>
<tr>
<th>User Name</th>
<th>Email</th>
<th>One Liner</th>
<th>First Name</th>
<th>Last Name</th>
<th>About</th>
<th>Favourite Fruit</th>
<th>Movies</th>
<th>Design</th>
<th>Information</th>
</tr>
</thead>
<tbody id="output">
<tr>
<td colspan="10" class="text-center" id="no-data">--------- No Data ---------</td>
</tr>
</tbody>
</table>
</div>
<div id="pagination" class="text-center"></div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
</body>
</html>
body{
background-color: aliceblue;
}
.title{
font-weight: 800;
}
input{
cursor: text;
}
input[type="radio"], input[type="checkbox"]{
cursor: pointer;
}
.table{
margin: 0 !important;
}
.form-control{
border-left: 0;
}
.text-end{
color: rgba(53,179,115,255);
font-size: 16px;
font-weight: 700;
}
.btn{
background-color: rgba(53,179,115,255);
font-weight: 700;
}
.form-text{
font-size: 14px;
}
a{
text-decoration: none;
}
.hr-lines{
position: relative;
max-width: 100%;
margin:20px auto;
text-align: center;
}
.hr-lines::before{
content:" ";
height: 2px;
width: 45%;
background: #dee2e6;
display: block;
position: absolute;
top: 50%;
left: 0;
}
.hr-lines::after{
content:" ";
height: 2px;
width: 45%;
background: #dee2e6;
display: block;
position: absolute;
top: 50%;
right: 0;
}
.google{
background-color: transparent;
border-color: #dee2e6;
font-weight: 700;
text-align: center;
}
.width{
max-width: 1000px;
}
.container .terms{
max-width: 250px;
}
.d-star i, .i-star i{
font-size: 25px;
width: auto;
cursor: pointer;
}
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid #007fff;
}
$(document).ready(function () {
var $userName = $('#userName');
var $email = $('#email');
var $password = $('#password');
var $confirmPassword = $('#confirm-password');
var $oneliner = $('#oneliner');
var $firstName = $('#first-name');
var $lastName = $('#last-name');
var $about = $('#about');
var $checkbox = $('input[type="checkbox"]');
var $radio = $('input[type="radio"]');
var $submit = $('#submitBtn');
$userName.on('click input', validateUserName);
$email.on('click input', validateEmail);
$password.on('click input', validatePassword);
$confirmPassword.on('click input', validateConfirmPassword);
$oneliner.on('click input', validateOneliner);
$firstName.on('click input', validateFirstName);
$lastName.on('click input', validateLastName);
$about.on('click input', validateAbout);
$checkbox.on('click input', validateCheckBox);
$radio.on('click input', radioValidate);
var isNameValid = false;
var isEmailValid = false;
var isPasswordValid = false;
var isConfirmPasswordValid = false;
var isOnelinerValid = false;
var isFirstNameValid = false;
var isLastNameValid = false;
var isAboutValid = false;
var isCheckBoxValid = false;
var isRadioValid = false;
$submit.on('click', function (event) {
event.preventDefault();
if (isNameValid && isEmailValid && isPasswordValid && isConfirmPasswordValid && isOnelinerValid && isFirstNameValid && isLastNameValid && isAboutValid && isCheckBoxValid && isRadioValid) {
printData();
hideNoData();
// Empty the form
$userName.val('');
$email.val('');
$password.val('');
$confirmPassword.val('');
$oneliner.val('');
$firstName.val('');
$lastName.val('');
$about.val('');
$checkbox.prop('checked', false);
$radio.prop('checked', false);
//reset borders
$userName.css({"border-color": "", "box-shadow": ""});
$userName.prev('span').css({"border-color": "", "box-shadow": ""});
$email.css({"border-color": "", "box-shadow": ""});
$email.prev('span').css({"border-color": "", "box-shadow": ""});
$password.css({"border-color": "", "box-shadow": ""});
$password.prev('span').css({"border-color": "", "box-shadow": ""});
$confirmPassword.css({"border-color": "", "box-shadow": ""});
$confirmPassword.prev('span').css({"border-color": "", "box-shadow": ""});
$oneliner.css({"border-color": "", "box-shadow": ""});
$oneliner.prev('span').css({"border-color": "", "box-shadow": ""});
$firstName.css({"border-color": "", "box-shadow": ""});
$firstName.prev('span').css({"border-color": "", "box-shadow": ""});
$lastName.css({"border-color": "", "box-shadow": ""});
$lastName.prev('span').css({"border-color": "", "box-shadow": ""});
$about.css({"border-color": "", "box-shadow": ""});
$about.prev('span').css({"border-color": "", "box-shadow": ""});
//reset star clicks
$("#d1, #d2, #d3, #d4, #d5").removeClass("fa-solid").addClass("fa-regular");
$("#i1, #i2, #i3, #i4, #i5").removeClass("fa-solid").addClass("fa-regular");
//reset star clicks
$("#design-output").text("");
$("#info-output").text("");
// Reset validation boolean
isNameValid = false;
isEmailValid = false;
isPasswordValid = false;
isConfirmPasswordValid = false;
isOnelinerValid = false;
isFirstNameValid = false;
isLastNameValid = false;
isAboutValid = false;
isCheckBoxValid = false;
isRadioValid = false;
} else {
// Validate all fields
validateUserName();
validateEmail();
validatePassword();
validateConfirmPassword();
validateOneliner();
validateFirstName();
validateLastName();
validateAbout();
validateCheckBox();
radioValidate();
// if no rating is clicked
$("#design-output").text("Please rate the design");
// if no rating is clicked
$("#info-output").text("Please rate the information");
}
});
//! Design Star
$("#d1").on('click', function () {
$("#d1").removeClass("fa-regular").addClass("fa-solid");
$("#d2, #d3, #d4, #d5").removeClass("fa-solid").addClass("fa-regular");
$("#design-output").text("You Rated 1/5");
});
$("#d2").on('click', function () {
$("#d1, #d2").removeClass("fa-regular").addClass("fa-solid");
$("#d3, #d4, #d5").removeClass("fa-solid").addClass("fa-regular");
$("#design-output").text("You Rated 2/5");
});
$("#d3").on('click', function () {
$("#d1, #d2, #d3").removeClass("fa-regular").addClass("fa-solid");
$("#d4, #d5").removeClass("fa-solid").addClass("fa-regular");
$("#design-output").text("You Rated 3/5");
});
$("#d4").on('click', function () {
$("#d1, #d2, #d3, #d4").removeClass("fa-regular").addClass("fa-solid");
$("#d5").removeClass("fa-solid").addClass("fa-regular");
$("#design-output").text("You Rated 4/5");
});
$("#d5").on('click', function () {
$("#d1, #d2, #d3, #d4, #d5").removeClass("fa-regular").addClass("fa-solid");
$("#design-output").text("You Rated 5/5");
});
//! Information Star
$("#i1").on('click', function () {
$("#i1").removeClass("fa-regular").addClass("fa-solid");
$("#i2, #i3, #i4, #i5").removeClass("fa-solid").addClass("fa-regular");
$("#info-output").text("You Rated 1/5");
});
$("#i2").on('click', function () {
$("#i1, #i2").removeClass("fa-regular").addClass("fa-solid");
$("#i3, #i4, #i5").removeClass("fa-solid").addClass("fa-regular");
$("#info-output").text("You Rated 2/5");
});
$("#i3").on('click', function () {
$("#i1, #i2, #i3").removeClass("fa-regular").addClass("fa-solid");
$("#i4, #i5").removeClass("fa-solid").addClass("fa-regular");
$("#info-output").text("You Rated 3/5");
});
$("#i4").on('click', function () {
$("#i1, #i2, #i3, #i4").removeClass("fa-regular").addClass("fa-solid");
$("#i5").removeClass("fa-solid").addClass("fa-regular");
$("#info-output").text("You Rated 4/5");
});
$("#i5").on('click', function () {
$("#i1, #i2, #i3, #i4, #i5").removeClass("fa-regular").addClass("fa-solid");
$("#info-output").text("You Rated 5/5");
});
//! Red Color Border
function setRedBorder($element) {
$element.css({
"border-color": "#FF0000",
"box-shadow": "inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6)"
});
$element.prev('span').css({
"border-color": "#FF0000",
"box-shadow": "inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6)"
});
}
//! Green Color Border
function setGreenBorder($element) {
$element.css({
"border-color": "#00FF00",
"box-shadow": "inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(0, 255, 0, 0.6)"
});
$element.prev('span').css({
"border-color": "#00FF00",
"box-shadow": "inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(0, 255, 0, 0.6)"
});
}
function validateUserName(userName) {
var userName = $userName.val();
var userNameRegex = /^[a-z0-9]+$/;
if (userName.length == 0) {
$("#user-error").text("UserName is required *");
setRedBorder($userName);
isNameValid = false;
}
else if (userName.length < 10) {
$("#user-error").text("UserName must be at least 10 characters long *");
setRedBorder($userName);
isNameValid = false;
}
else if (userName.length > 20) {
$("#user-error").text("UserName must not be more than 20 characters long *");
setRedBorder($userName);
isNameValid = false;
}
else if (!userNameRegex.test(userName)) {
$("#user-error").text("UserName can only contain lowercase letters, numbers and no space *");
setRedBorder($userName);
isNameValid = false;
}
else {
$("#user-error").text("");
setGreenBorder($userName);
isNameValid = true;
}
return isNameValid;
}
function validateEmail(email) {
var email = $email.val();
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (email.length == 0) {
$("#email-error").text("Email is required *");
setRedBorder($email);
isEmailValid = false;
}
else if (!emailRegex.test(email)) {
$("#email-error").text("Invalid email format *");
setRedBorder($email);
isEmailValid = false;
}
else {
$("#email-error").text("");
setGreenBorder($email);
isEmailValid = true;
}
}
function validatePassword(password) {
var password = $password.val();
var passwordRegex = /^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*\W)(?!.* )/
if (password.length == 0) {
$("#password-error").text("Password is required *");
setRedBorder($password);
isPasswordValid = false;
}
else if (password.length < 8) {
$("#password-error").text("Password must be at least 8 characters long *");
setRedBorder($password);
isPasswordValid = false;
}
else if (!passwordRegex.test(password)) {
$("#password-error").text("Password must contain one Capital letter,number and special character *");
setRedBorder($password);
isPasswordValid = false;
} else if (password.length > 20) {
$("#password-error").text("Password should not be more than 20 characters long *");
setRedBorder($password);
isPasswordValid = false;
}
else {
$("#password-error").text("");
setGreenBorder($password);
isPasswordValid = true;
}
}
function validateConfirmPassword(confirmPassword) {
var confirmPassword = $confirmPassword.val();
var password = $password.val();
if (confirmPassword.length == 0) {
$("#confirm-password-error").text("Confirm password is required *");
setRedBorder($confirmPassword);
isConfirmPasswordValid = false;
}
else if (confirmPassword != password) {
$("#confirm-password-error").text("Passwords do not match *");
setRedBorder($confirmPassword);
isConfirmPasswordValid = false;
}
else {
$("#confirm-password-error").text("");
setGreenBorder($confirmPassword);
isConfirmPasswordValid = true;
}
}
function validateOneliner(oneliner) {
var oneliner = $oneliner.val();
if (oneliner.length == 0) {
$("#oneliner-error").text("Oneliner is required *");
setRedBorder($oneliner);
isOnelinerValid = false;
}
else if (oneliner.length < 10) {
$("#oneliner-error").text("Oneliner should be atleast 10 characters long *");
setRedBorder($oneliner);
isOnelinerValid = false;
}
else if (oneliner.length > 30) {
$("#oneliner-error").text("Oneliner should not more then 30 characters long *");
setRedBorder($oneliner);
isOnelinerValid = false;
}
else {
$("#oneliner-error").text("");
setGreenBorder($oneliner);
isOnelinerValid = true;
}
}
function validateFirstName(firstName) {
var firstName = $firstName.val();
if (firstName.length == 0) {
$("#first-name-error").text("First name is required *");
setRedBorder($firstName);
isFirstNameValid = false;
}
else if (firstName.length < 3) {
$("#first-name-error").text("First name should be atleast 3 characters long *");
setRedBorder($firstName);
isFirstNameValid = false;
}
else if (firstName.length > 8) {
$("#first-name-error").text("First name should not more then 8 characters long *");
setRedBorder($firstName);
isFirstNameValid = false;
}
else {
$("#first-name-error").text("");
setGreenBorder($firstName);
isFirstNameValid = true;
}
}
function validateLastName(lastName) {
var lastName = $lastName.val();
if (lastName.length == 0) {
$("#last-name-error").text("Last name is required *");
setRedBorder($lastName);
isLastNameValid = false;
}
else if (lastName.length < 3) {
$("#last-name-error").text("Last name should be atleast 3 characters long *");
setRedBorder($lastName);
isLastNameValid = false;
}
else if (lastName.length > 8) {
$("#last-name-error").text("Last name should not more then 8 characters long *");
setRedBorder($lastName);
isLastNameValid = false;
} else {
$("#last-name-error").text("");
setGreenBorder($lastName);
isLastNameValid = true;
}
}
function validateAbout(about) {
var about = $about.val();
if (about.length == 0) {
$("#about-error").text("About is required *");
setRedBorder($about);
isAboutValid = false;
}
else if (about.length < 10) {
$("#about-error").text("About should be atleast 10 characters long *");
setRedBorder($about);
isAboutValid = false;
}
else if (about.length > 100) {
$("#about-error").text("About should not more then 100 characters long *");
setRedBorder($about);
isAboutValid = false;
}
else {
$("#about-error").text("");
setGreenBorder($about);
isAboutValid = true;
}
}
function radioValidate() {
if ($("input[type='radio']:checked").length == 0) {
$("#radio-error").text("Please select one *");
isRadioValid = false;
} else {
$("#radio-error").text("");
isRadioValid = true;
}
}
function validateCheckBox() {
let checked = $("input[type='checkbox']:checked").length;
if (!checked) {
$("#checkbox-error").text("Please check atleast one movie *");
isCheckBoxValid = false;
} else {
$("#checkbox-error").text("");
isCheckBoxValid = true;
}
}
function printData() {
var userName = $userName.val();
var email = $email.val();
var oneliner = $oneliner.val();
var firstName = $firstName.val();
var lastName = $lastName.val();
var about = $about.val();
var radio = $("input[type='radio']:checked").map(function () {
return $(this).val();
}).get().join(", ");
var checkbox = $("input[type='checkbox']:checked").map(function () {
return $(this).val();
}).get().join(", ");
var designStar = $("#design-output").text();
var infoStar = $("#info-output").text();
$("#output").append("<tr><td>" + userName + "</td><td>" + email + "</td><td>" + oneliner + "</td><td>" + firstName + "</td><td>" + lastName + "</td><td>" + about + "</td><td>" + radio + "</td><td>" + checkbox + "</td><td>" + designStar + "</td><td>" + infoStar + "</td></tr>");
}
function hideNoData() {
$("#no-data").hide();
}
});
Also see: Tab Triggers