How I can uncheck checkbox when both of my inputs [type=text] cleared or empty?

How I can uncheck&nbsp;input&nbsp;of type&nbsp;<strong>checkbox</strong>&nbsp;when both of my&nbsp;inputs of type&nbsp;<strong>text</strong>&nbsp;are empty, and checked if one of my&nbsp;inputs of type&nbsp;<strong>text</strong>&nbsp;is filled?

How I can uncheck input of type checkbox when both of my inputs of type text are empty, and checked if one of my inputs of type text is filled?

$('input[name="t2"],input[name="t3"]').keyup(function() {
  $('input[name="t1"]').prop("checked", $.trim($(this).val()).length != 0);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<input type="checkbox" name="t1" /> Price range from:
<input type="text" name="t2" /> to <input type="text" name="t2" />

 Run code snippetExpand snippet

JSFiddle : here in this link

It executes correctly when I type something on any input type text(checkbox checked), but not working when I clear both of fields, because the checkbox unchecked when only one of inputs clear. Would you please help me solve this? Thank you

Multiple form submit upon last form PHP

I am working on a web application using PHP and sql on localhost using wamp server.

I am working on a web application using PHP and sql on localhost using wamp server.

I have a requirement to make multiple forms Like personal details, Physical detail medical detail and religion detail with save button for each form in each page of a form. For these forms I designed database tables separately, like personal detail , medical, religion and users details have separate database tables with primary key and a foreign key of User Id from user table to distinguish records specific to each user.

  1. My problem now is what approach will I use to submit all forms with single button? Before submitting my application checks whether all required fields are filled or not if filledthen it would submit all pre filled forms.
  2. Second question is when user submits all forms with single click
  3. where is data is to be stored ?


3 JavaScript libraries to replace jQuery

3 JavaScript libraries to replace jQuery

Ubiquitous jQuery has been outmoded by JavaScript and browser advances. Cash, Zepto, and Syncfusion are three JavaScript libraries picking up where jQuery left off

Simplifying tasks such as HTML document traversal, animation, and event handling, the stalwart jQuery JavaScript library changed the face of web development. As of May 2019, **jQuery **is still being used in 74 percent of known websites, according to web technology surveyor W3Techs. Nevertheless, the jQuery library, which debuted in August 2006, is now being viewed by some developers as an older technology whose time has passed.

Alternatives to **jQuery **have emerged in recent years, such as the Cash library or even just modern, vanilla JavaScript, now that web browsers all handle **JavaScript libraries **the same way and jQuery is no longer needed to solve compatibility issues. Arguments on Reddit and videos on YouTube make the case that jQuery has become obsolete, or at least is not as essential as it once was.

Why jQuery is no longer needed

In one YouTube presentation, “Is jQuery still relevant in 2018?,” web development educator Brad Traversy acknowledges that jQuery is probably the best generalized JavaScript library ever created. It is easy to learn, cross-browser compatible, more concise than older vanilla JavaScript, and rich in plug-ins offering specific functionality. But JavaScript has advanced far since ECMAScript 6, and jQuery is no longer needed in many situations, Traversy concludes.

In another video, coding educator Kenneth Lowrey argues that becoming fluent in jQuery is a waste of time. In the current web development landscape, modern browsers handle JavaScript the same, for the most part. In most cases, native JavaScript code is better than a “bloated legacy library like jQuery,” he says.

While jQuery had been the choice for making HTTP requests, for example, ECMAScript 6 brought forth Fetch, a promised-based API that makes HTTP requests easier. And the advancement does not stop with HTTP. Where jQuery has utilities for tasks such as manipulating arrays, vanilla JavaScript now has improved accommodations for these operations, too.

Animations are still more difficult with vanilla JavaScript than jQuery, but there are other options such as CSS transitions or keyframes, Traversy points out. The third-party GreenSock library also can be used for animations. For DOM manipulation, a task once ruled by jQuery, native browser APIs have closed the gap.

For tasks that cannot be done in vanilla JavaScript, Traversy recommends specialized libraries, instead of a generalized library like jQuery. Traversy also recommends using JavaScript frameworks such as React, Angular, or Vue for mid-size and large applications. Traversy still recommends jQuery for use on simple sites with no framework.

jQuery alternatives

What should you use instead of jQuery? Besides modern, vanilla JavaScript, a short list of jQuery alternatives includes Cash, Zepto, and Syncfusion Essential JS 2. Cash and Zepto are open source JavaScript libraries available under an MIT license. Syncfusion Essential JS 2 is a commercial product.

Cash

Cash has more than 3,570 stars on GitHub. Billed as an “absurdly small jQuery alternative” for modern browsers, Cash has a jQuery-style syntax for manipulating the DOM and takes up 32KB of space, uncompressed. Cash supports capabilities including namespaced events, TypeScript types, and modern builds. You can download Cash from GitHub.

Zepto

Zepto is described as “a minimalist **JavaScript library **with a largely jQuery-compatible API.” Developers who know jQuery already know how to use Zepto, its makers go on to say. Zepto purports to be much smaller and faster-loading than jQuery, and can work with the PhoneGap toolset for mobile and desktop browsers. You can download Zepto from the project website.

Syncfusion Essential JS 2

Syncfusion Essential JS 2 is a commercially licensed JavaScript UI controls library written in TypeScript. Serving as an alternative to the jQuery UI library, Syncfusion is designed to be a low-overhead, lightweight, and modular library to improve web applications. Syncfusion supports frameworks including Angular, React, and Vue. You can purchase Syncfusion Essential JS 2 or download a free trial from the Syncfusion website. Complete source code, unit test files, test scripts, and live demos are available on GitHub.

Material Login & Signup Form with CSS, HTML and JavaScript

Material Login & Signup Form with CSS, HTML and JavaScript

How we can create a login and signup form with the material design using HTML CSS JavaScript? Solution: See this CSS Material Login & Signup Form With jQuery, Material Design Form.

Basically, Material Design is a type of design and it is developed by Google. Material Design uses more grid-based layouts, responsive animations and transitions, padding, and depth effects such as lighting and shadows. Languages like angular, react has an inbuilt material design for elements but we can create that kind of design using CSS.

Today you will learn to create Material Design Form using HTML and CSS. Basically, there is a login form and a button on the right-top of the form, when you will click on that then the signup or registration form will appear. And all the input fields and the layout designed as material design, and transitions are also like that.

So, Today I am sharing CSS Material Login & Signup Form With jQuery. There I have used pure HTML and CSS but jQuery is only for the toggle feature. And there material design effect is a combination of shadow, size, animation, etc. Believe me, this is a very good designed login/registration form you can use it on your website after backed integration.

If you are thinking now how this material design form actually is, then see the preview given below.

CSS Material Login & Signup Form With jQuery Source Code

Before sharing source code, let’s talk about it. First I have created two different sections one for login and one for the registration form. Inside a single card, I have placed a button, input, and label to creating the complete form. And also in the HTML file, I have linked external files like jQuery, font-awesome, and other files.

Now using CSS I have placed all the elements in the right place, as you can see in the preview. There I have created two cards and a toggle button which is for the register section. There is a class name .active which is handling the whole function. I have put the condition when it’s active then do these things to element. For signup form expand feature I have used CSS transform: scale (); command (info).

jQuery just handling the toggle feature by adding and removing the active class. All the design and animation are based on pure CSS, and the register icon is powered by font-awesome library. And this form is responsive means it will fit on every screen size, I have used CSS @media query for creating this. There I have created many things using CSS, I can’t explain all you will understand after getting the codes.

For Creating this program, you have to create 3 files. First for HTML, second for CSS, and the third for JavaScript. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>Material Login Form | Webdevtrick.com</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900|RobotoDraft:400,100,300,500,700,900'>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'>
<link rel="stylesheet" href="style.css">
 
</head>
<body>
 
<div class="container">
  <div class="card">
    <h1 class="title">Login</h1>
    <form>
      <div class="input-container">
        <input type="text" id="usern" required="required"/>
        <label for="usern">Username</label>
        <div class="bar"></div>
      </div>
      <div class="input-container">
        <input type="text" id="passw" required="required"/>
        <label for="passw">Password</label>
        <div class="bar"></div>
      </div>
      <div class="button-container">
        <button><span>Go</span></button>
      </div>
      <div class="footer"><a href="#">Forgot your password?</a></div>
    </form>
  </div>
  <div class="card alt">
    <div class="toggle"></div>
    <h1 class="title">Register
      <div class="close"></div>
    </h1>
    <form>
      <div class="input-container">
        <input type="text" id="usernR" required="required"/>
        <label for="usernR">Username</label>
        <div class="bar"></div>
      </div>
      <div class="input-container">
        <input type="text" id="passwR" required="required"/>
        <label for="passwR">Password</label>
        <div class="bar"></div>
      </div>
      <div class="input-container">
        <input type="text" id="repeatpass" required="required"/>
        <label for="repeatpass">Repeat Password</label>
        <div class="bar"></div>
      </div>
      <div class="button-container">
        <button><span>Next</span></button>
      </div>
    </form>
  </div>
</div>
 
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
  <script  src="function.js"></script>
 
</body>
</html>

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

body {
  background: #e9e9e9;
  color: #666666;
  font-family: 'RobotoDraft', 'Roboto', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
.container {
  position: relative;
  max-width: 460px;
  width: 100%;
  margin: 0 auto 100px;
  margin-top: 10%;
 
}
.container.active .card:first-child {
  background: #f2f2f2;
  margin: 0 15px;
}
.container.active .card.alt {
  top: 20px;
  right: 0;
  width: 100%;
  min-width: 100%;
  height: auto;
  border-radius: 5px;
  padding: 60px 0 40px;
  overflow: hidden;
}
.container.active .card.alt .toggle {
  position: absolute;
  top: 40px;
  right: -70px;
  box-shadow: none;
  -webkit-transform: scale(10);
  transform: scale(10);
  transition: -webkit-transform .3s ease;
  transition: transform .3s ease;
  transition: transform .3s ease, -webkit-transform .3s ease;
}
.container.active .card.alt .toggle:before {
  content: '';
}
.container.active .card.alt .title,
.container.active .card.alt .input-container,
.container.active .card.alt .button-container {
  left: 0;
  opacity: 1;
  visibility: visible;
  transition: .3s ease;
}
.container.active .card.alt .title {
  transition-delay: .3s;
}
.container.active .card.alt .input-container {
  transition-delay: .4s;
}
.container.active .card.alt .input-container:nth-child(2) {
  transition-delay: .5s;
}
.container.active .card.alt .input-container:nth-child(3) {
  transition-delay: .6s;
}
.container.active .card.alt .button-container {
  transition-delay: .7s;
}
 
.card {
  position: relative;
  background: #ffffff;
  border-radius: 5px;
  padding: 60px 0 40px 0;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  transition: .3s ease;
}
 
.card .title {
  position: relative;
  z-index: 1;
  border-left: 5px solid #ff4444;
  margin: 0 0 35px;
  padding: 10px 0 10px 50px;
  color: #ff4444;
  font-size: 32px;
  font-weight: 600;
  text-transform: uppercase;
}
.card .input-container {
  position: relative;
  margin: 0 60px 50px;
}
.card .input-container input {
  outline: none;
  z-index: 1;
  position: relative;
  background: none;
  width: 100%;
  height: 60px;
  border: 0;
  color: #212121;
  font-size: 24px;
  font-weight: 400;
}
.card .input-container input:focus ~ label {
  color: #9d9d9d;
  -webkit-transform: translate(-12%, -50%) scale(0.75);
          transform: translate(-12%, -50%) scale(0.75);
}
.card .input-container input:focus ~ .bar:before, .card .input-container input:focus ~ .bar:after {
  width: 50%;
}
.card .input-container input:valid ~ label {
  color: #9d9d9d;
  -webkit-transform: translate(-12%, -50%) scale(0.75);
          transform: translate(-12%, -50%) scale(0.75);
}
.card .input-container label {
  position: absolute;
  top: 0;
  left: 0;
  color: #757575;
  font-size: 24px;
  font-weight: 300;
  line-height: 60px;
  transition: 0.2s ease;
}
.card .input-container .bar {
  position: absolute;
  left: 0;
  bottom: 0;
  background: #757575;
  width: 100%;
  height: 1px;
}
.card .input-container .bar:before, .card .input-container .bar:after {
  content: '';
  position: absolute;
  background: #ff4444;
  width: 0;
  height: 2px;
  transition: .2s ease;
}
.card .input-container .bar:before {
  left: 50%;
}
.card .input-container .bar:after {
  right: 50%;
}
.card .button-container {
  margin: 0 60px;
  text-align: center;
}
.card .button-container button {
  outline: 0;
  cursor: pointer;
  position: relative;
  display: inline-block;
  background: 0;
  width: 240px;
  border: 2px solid #e3e3e3;
  padding: 20px 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  overflow: hidden;
  transition: .3s ease;
}
.card .button-container button span {
  position: relative;
  z-index: 1;
  color: #ddd;
  transition: .3s ease;
}
.card .button-container button:before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  background: #ff4444;
  width: 30px;
  height: 30px;
  border-radius: 100%;
  margin: -15px 0 0 -15px;
  opacity: 0;
  transition: .3s ease;
}
.card .button-container button:hover, .card .button-container button:active, .card .button-container button:focus {
  border-color: #ff4444;
}
.card .button-container button:hover span, .card .button-container button:active span, .card .button-container button:focus span {
  color: #ff4444;
}
.card .button-container button:active span, .card .button-container button:focus span {
  color: #ffffff;
}
.card .button-container button:active:before, .card .button-container button:focus:before {
  opacity: 1;
  -webkit-transform: scale(10);
  transform: scale(10);
}
.card .footer {
  margin: 40px 0 0;
  color: #d3d3d3;
  font-size: 24px;
  font-weight: 300;
  text-align: center;
}
.card .footer a {
  color: inherit;
  text-decoration: none;
  transition: .3s ease;
}
.card .footer a:hover {
  color: #bababa;
}
.card.alt {
  position: absolute;
  top: 40px;
  right: -70px;
  z-index: 10;
  width: 140px;
  height: 140px;
  background: none;
  border-radius: 100%;
  box-shadow: none;
  padding: 0;
  transition: .3s ease;
}
.card.alt .toggle {
  position: relative;
  background: #ff4444;
  width: 140px;
  height: 140px;
  border-radius: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  color: #ffffff;
  font-size: 58px;
  line-height: 140px;
  text-align: center;
  cursor: pointer;
}
.card.alt .toggle:before {
  content: '\f040';
  display: inline-block;
  font: normal normal normal 14px/1 FontAwesome;
  font-size: inherit;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-transform: translate(0, 0);
          transform: translate(0, 0);
}
.card.alt .title,
.card.alt .input-container,
.card.alt .button-container {
  left: 100px;
  opacity: 0;
  visibility: hidden;
}
.card.alt .title {
  position: relative;
  border-color: #ffffff;
  color: #ffffff;
}
.card.alt .title .close {
  cursor: pointer;
  position: absolute;
  top: 0;
  right: 60px;
  display: inline;
  color: #ffffff;
  font-size: 58px;
  font-weight: 400;
}
.card.alt .title .close:before {
  content: '\00d7';
}
.card.alt .input-container input {
  color: #ffffff;
}
.card.alt .input-container input:focus ~ label {
  color: #ffffff;
}
.card.alt .input-container input:focus ~ .bar:before, .card.alt .input-container input:focus ~ .bar:after {
  background: #ffffff;
}
.card.alt .input-container input:valid ~ label {
  color: #ffffff;
}
.card.alt .input-container label {
  color: rgba(255, 255, 255, 0.8);
}
.card.alt .input-container .bar {
  background: rgba(255, 255, 255, 0.8);
}
.card.alt .button-container button {
  width: 100%;
  background: #ffffff;
  border-color: #ffffff;
}
.card.alt .button-container button span {
  color: #ff4444;
}
.card.alt .button-container button:hover {
  background: rgba(255, 255, 255, 0.9);
}
.card.alt .button-container button:active:before, .card.alt .button-container button:focus:before {
  display: none;
}
@media (max-width: 750px) {
  .card.alt .toggle {
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 25px;
  }
  .container.active .card.alt .toggle {
   transform: scale(27);
  }
  .container.active .card.alt{
   left: 0;
  }
}

function.js

The last step, create a JavaScript file named ‘function.js‘ and put the codes.

$('.toggle').on('click', function() {
  $('.container').stop().addClass('active');
});
 
$('.close').on('click', function() {
  $('.container').stop().removeClass('active');
});

That’s It. Now you have successfully created CSS Material Login & Signup Form With jQuery, Material Design Form. If you have any doubt or question comment down below.

Thanks for reading !