Ordinal number format helps to add st/nd/rd/th suffix to the calendar date. It is also a user-friendly way to represent a date on the web page. Mostly the ordinal suffix is added to the day of the month in a date string. We will create a custom JavaScript function to add st/nd/rd/th format based on the given number using JavaScript.

By: CodexWorld Sep 8, 2021

HTML <a> tag is used to open URL in the same window and tab. If you want to open URL with JavaScript, window.open() method allows opening URL in the browser tab or window. You can use _self value in the second parameter of the window.open() method to open URL in the same tab and in the same window with JavaScript.

By: CodexWorld Apr 15, 2023

Regular Expression (RegEx) is the easiest way to trim a specific character from a string in JavaScript. Use the JavaScript replace() method with RegEx to remove a specific character from the string. The example code snippet helps to remove comma (,) characters from the start and end of the string using JavaScript.

By: CodexWorld Apr 14, 2021

The browser’s back button allows the user to redirect back to the previous page that accessing before the current page. If you want to restrict users to back the previous page on your web application, the browser back button needs to be disabled. The browser’s back navigation can be disabled with JavaScript.

By: CodexWorld Mar 19, 2021

JavaScript toLocaleString() method provides an easy way to convert date to a specific format. You can change the date format as per your needs using JavaScript. Use toLocaleString() method to convert date to a specific format in JavaScript.

By: CodexWorld Mar 26, 2020

Strip tags from the string, is very useful when you want to extract text from string that contains HTML tags. You can remove the HTML tags from string using Regex in JavaScript. Use JavaScript replace() method with Regex to remove HTML tags from string.

By: CodexWorld Mar 26, 2020

Progress Bar helps to display the file upload status in real-time. The progress bar is very useful to make the file upload process user-friendly. Use xhr option in the $.ajax() method to get the file upload progress and make a progress bar with percentage using JavaScript.

By: CodexWorld Dec 18, 2019

The keyCode property of the KeyboardEvent helps to track the key press on the keyboard using JavaScript. You can easily trigger a button by the Enter key press using JavaScript. Use KeyboardEvent keyCode property to trigger button click for submitting form or input field value with JavaScript.

By: CodexWorld Jun 28, 2019

Generally, the jQuery toggle() method is used to show and hide the HTML element on the web page. But if you don’t want to use the jQuery library, the toggle effect can be easily added using JavaScript. Using JavaScript you can check the visibility of an element and show/hide the HTML element based on their visibility.

By: CodexWorld Feb 28, 2019
keyboard_double_arrow_up