Posts

Showing posts with the label JQuery

How to show input fields based on dropdown selected options using jQuery

Image
Hide show input fields based on select value Many times, while learning a new technology or a framework, it is not sufficient to read just the documentation and syntax, we need to practice. Many of us may try on our own sometimes things will work out for us sometimes we don't know how to evaluate ourselves. All our recent practice articles were published in that thought of giving readers a practice in jQuery  concepts.  Follow our FB page @CreativeTechnocrayts Other jQuery practice articles 1. jQuery DOM functions and array 2. DOM manipulation in jQuery 3. Daily ui practice - Input range sliders Subscribe to Creative Technocrayts and get updates in front end development and UI / UX. Some of us might run into a problem of  showing input value based on user selecting an option from the dropdown. We can achieve that in many ways.If the user is not selecting a value, the form is incomplete so the user cannot submit the form To check whether the select value is s...

UI practice #4 How to Check if At Least One Checkbox is Selected Using jQuery | jQuery Tutorial for Beginners

Image
How to check whether at least one input is selected using jQuery When building forms, it's often necessary to ensure that users make a selection before submitting. This is especially true for options like checkboxes, where users might need to choose at least one option. In this article, we'll show you how to easily check if a checkbox is selected using jQuery and how to prompt users to select at least one option before submission. For instance, consider developing a survey form where users need to select their preferred communication methods (Email, SMS, etc.). If none are selected, it's important to notify the user to make a selection before they can proceed. How to check that using jQuery When a select option is checked checked attribute is added. To check whether any of it is checked, :checked is used in jQuery. If any of the checkboxes have the checked attribute, then the user is allowed to submit. How to check whether an el...

jQuery Tutorial #2 - DOM functions and array

Image
Creating boxes with repeating background color - jQuery practice In this article, we’ll cover how to use jQuery , DOM methods , and JavaScript arrays to create interactive boxes with repeating background colors. You could try our previous practice exercise for hands on jquery knowledge. Jquery array i) When you get an input, check whether it is validated as a number. ii) Based on the input value, create a number of boxes. iii) Set all the boxes with background colors from an array. How to Get an Input Value from a Textbox var inputValue = $(this).val(); console.log(inputValue); Testing Whether the Input Value is a Number To test whether the input is a number, we use a regular expression pattern. if (/^[0-9]$/.test(inputValue)) { console.log("It is...

What is the difference between Javascript, jQuery, jQuery UI, jQuery mobile?

Image
What is the difference between Javascript, JQuery, JQuery UI, JQuery mobile? Javascript Javascript is a programming language with its own syntax, functions, data structures and loops. Javascript is the most popular language used in web development. According to Stack overflow 2018 survey results Javascript is the most popular programming language. It has become an ubiquitous in web development. What is the difference between JQuery and Javascript JQuery is a Javascript library. It is built on top of Javascript and makes use of its functions. Jquery carries the motto “write less; do more”. JQuery is an extensive library making use of Javascript features and function within its library. JQuery framework is useful for 1) Manipulating DOM elements 2) CSS Selectors manipulation 3) Handling AJAX data for communicating with servers perform actions on specific events. 4) AJAX communication with servers 5) Animation effects 6) HTTP requests JQuery is said to have poor backwar...

Datatables.net - Plugin options

Image
DataTables jQuery Plugin Options – Complete Guide In Part I of this series, we introduced the basics of the DataTables.net jQuery plugin . The DataTables jQuery plugin provides a rich set of configuration options for sorting, paging, search, and responsive layouts. Let’s see how you can utilize these options efficiently. CDN Links for DataTables Add the following CSS and JS files to your project using CDN links: Stylesheet References https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css https://cdn.datatables.net/responsive/2.2.1/css/responsive.dataTables.min.css Script References https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js https://cdn.datatables.net/responsive/2.2.1/css/responsive.dataTables.min.css Disable All Options $("#example").dataTable({ paging: false, searching: false, info: false }); To display “Show entries” dropdown at the bottom of the data table $('.promo-prici...

How to debug effectively while using jQuery

Image
jQuery is a JavaScript framework used for client side scripting of HTML. jQuery is used for 1) DOM manipulation 2) Event Handling 3) Animation jQuery is a popular framework with a large community of developers using it and many plugins have been developed using it. While working using jQuery in our projects, we may encounter the following errors in common. 1) Uncaught TypeError: Cannot read property 'xxx' of undefined 2) Uncaught TypeError: 'xxx' is not a function 3) SyntaxError: syntax error 4) 404 Errors 5) Conflict errors You may also read Datatables-plugin options Ways to handle errors in JQuery Check whether JQuery is loaded. if (typeof jQuery == 'undefined') { // jQuery IS NOT loaded, do stuff here. } Check whether the custom script is loaded. Check for console errors. You may find anyone of the above errors. Try whether it is working in document is ready or after page loads or ...