When a number is entered in a container and clicked on a button the scroller option to change the number is disabled to fixe the entered value. Given an HTML document containing <input type = “number”> attribute and the task is to disable the mouse scroll wheel to change number value using JavaScript/jQuery. Approach: Select… Continue reading How to disable scroll to change number in field using JavaScript
Author: Sanket Pal
How to perform “Sorting, Joining or joining with some symbol” actions on all array elements by using Underscore.js function _.invoke()
When we need to perform certain actions like sorting, joining, joining with some symbol, then we can use this underscore function to easily achieve all this actions. The _.invoke() function is used to perform certain actions like sorting, joining, joining with some symbol, make upper case etc the elements of an array. It call the function directly… Continue reading How to perform “Sorting, Joining or joining with some symbol” actions on all array elements by using Underscore.js function _.invoke()
How to give a specific format pattern for a date (DD/MM/YY OR MM/DD/YYYY) in JavaScript
If we want to give a specific pattern to a date like DD/MM/YYYY or MM/DD/YYYY we can use this method. Let’s break that down and see what’s going on up there. Again, we have wrapped the entire regular expression inside ^ and $, so that the match spans entire string. ( start of first subexpression. \d{1,2} matches at least 1… Continue reading How to give a specific format pattern for a date (DD/MM/YY OR MM/DD/YYYY) in JavaScript
JavaScript exception handelling for exception “Invalid code point”
The JavaScript exception “Invalid code point” occurs when NaN values, negative Integers (-1), non-Integers (5.4), or values larger than 0x10FFFF (1114111) are used with String.fromCodePoint(). Message:RangeError: Invalid code point -1 (V8-based) RangeError: -1 is not a valid code point (Firefox) RangeError: Arguments contain a value that is out of range of code points (Safari) What Went… Continue reading JavaScript exception handelling for exception “Invalid code point”
How to magnifiy a specific part of an image when hovered over it
This teqchnique can be used for the for the pdp pages where the products are to be shown by magnifiying the products to the customers. The image must be placed inside a container with relative positioning. The result can be put anywhere on the page, but must have the class name “img-zoom-result”. Make sure both… Continue reading How to magnifiy a specific part of an image when hovered over it
How to create a responsive navbar on an image
Creating a responsive navbar on an image.
By using Javascript make an area of the image to zoom when hovered over the specific area of the image.
We can zoom the are of the image where the mouse is hovered on the image which will help in showing the zoomed product in the pdp page to the user.
Auto-filling one field same as other using JavaScript
You might have noticed that sometimes websites like e-commerce or some government website have two address fields in their forms. One for the primary address and another for the secondary address(or one for billing address and another for the shipping address etc). Most of the time people have the same primary and secondary addresses and… Continue reading Auto-filling one field same as other using JavaScript
How to solve the error “SyntaxError: JSON.parse: bad parsing” in javascript
The JavaScript exceptions thrown by JSON.parse() occur when string failed to be parsed as JSON. The Error Mesages: SyntaxError: JSON.parse: unterminated string literal SyntaxError: JSON.parse: bad control character in string literal SyntaxError: JSON.parse: bad character in string literal SyntaxError: JSON.parse: bad Unicode escape SyntaxError: JSON.parse: bad escape character SyntaxError: JSON.parse: unterminated string SyntaxError: JSON.parse: no… Continue reading How to solve the error “SyntaxError: JSON.parse: bad parsing” in javascript
How to adjust the text sizes for iOS devices
Description: The text format in the iOS devices are little different from the normal devices which can be customized with this methods. SOLUTION:Adjusting the text size is important so that the text is legible when the user double-taps. If the user double-taps an HTML block element—such as a <div> element—then Safari on iOS scales the viewport to… Continue reading How to adjust the text sizes for iOS devices