JavaScript Archives - CodexWorld https://www.codexworld.com/how-to-category/javascript/ Web & Mobile App Development Company Wed, 01 May 2024 04:55:54 +0000 en-US hourly 1 https://www.codexworld.com/wp-content/uploads/2020/04/favicon.ico JavaScript Archives - CodexWorld https://www.codexworld.com/how-to-category/javascript/ 32 32 91409221 How to Hide an Alert Message After a Specific Time (5 seconds) using JavaScript? https://www.codexworld.com/how-to/hide-an-alert-message-after-a-specific-time-5-seconds-using-javascript/ https://www.codexworld.com/how-to/hide-an-alert-message-after-a-specific-time-5-seconds-using-javascript/#respond Wed, 01 May 2024 04:55:16 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=5606 Hide alert message automatically after some time is a great feature to make web form UI user-friendly. With the auto-hide feature, the alert message element closes automatically after some specific time and disappears from the web page. Use the setTimeout() method to hide the HTML element after some time from the web page.

The post How to Hide an Alert Message After a Specific Time (5 seconds) using JavaScript? appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/hide-an-alert-message-after-a-specific-time-5-seconds-using-javascript/feed/ 0 5606
How to Add Full Screen Control to OpenStreetMap using JavaScript https://www.codexworld.com/how-to/add-full-screen-control-to-openstreetmap-using-javascript/ https://www.codexworld.com/how-to/add-full-screen-control-to-openstreetmap-using-javascript/#respond Fri, 29 Mar 2024 06:30:46 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=5590 Full Screen Control feature helps to view maps in full-screen mode. The full-screen control button is placed at the corner of the map, it allows you to go full-screen or exit full-screen. There are some third-party plugins available to extend OpenStreetMap functionality with Leaflet. Use the leaflet.fullscreen plugin to add full screen control in OpenStreetMap with Leaflet using JavaScript.

The post How to Add Full Screen Control to OpenStreetMap using JavaScript appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/add-full-screen-control-to-openstreetmap-using-javascript/feed/ 0 5590
How to Customize the OpenStreetMap Marker Icon using JavaScript https://www.codexworld.com/how-to/customize-open-street-map-marker-icon-using-javascript/ https://www.codexworld.com/how-to/customize-open-street-map-marker-icon-using-javascript/#respond Tue, 26 Mar 2024 06:43:10 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=5586 Open Street Map provides a marker icon by default. You can change the default marker icon image and customize the icon size in OpenStreetMap. Customizing the marker icon helps to match the OpenStreetMap with the website UI. This guide will show you how to customize the OpenStreetMap marker icon using JavaScript.

The post How to Customize the OpenStreetMap Marker Icon using JavaScript appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/customize-open-street-map-marker-icon-using-javascript/feed/ 0 5586
How to change Page Orientation to Landscape in JavaScript window.print() https://www.codexworld.com/how-to/change-page-orientation-to-landscape-in-javascript-window-print/ https://www.codexworld.com/how-to/change-page-orientation-to-landscape-in-javascript-window-print/#respond Wed, 16 Aug 2023 12:09:19 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=5442 The window.print() method is the easiest solution to print HTML content in JavaScript. The Window print() method opens the browser's default print dialog to print the current document. You can use this method to print dynamic HTML content using JavaScript. By default, the page orientation is set to portrait in the print dialog. You can change page orientation in the print dialog by adding CSS to the document header.

The post How to change Page Orientation to Landscape in JavaScript window.print() appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/change-page-orientation-to-landscape-in-javascript-window-print/feed/ 0 5442
How to Get the Current Year to Display Dynamic Year in Copyright using JavaScript https://www.codexworld.com/how-to/get-current-year-to-display-dynamic-year-in-copyright-using-javascript/ https://www.codexworld.com/how-to/get-current-year-to-display-dynamic-year-in-copyright-using-javascript/#respond Mon, 24 Jul 2023 05:25:53 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=5411 It's always recommended for developers to use dynamic year in the copyright section so that the year can be changed automatically and updated with the current year. You can get the current year and add the dynamic year in HTML using JavaScript. Create a Date object and call the getFullYear() method to get the current year in JavaScript.

The post How to Get the Current Year to Display Dynamic Year in Copyright using JavaScript appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/get-current-year-to-display-dynamic-year-in-copyright-using-javascript/feed/ 0 5411
How to Validate File Size while Uploading using JavaScript or jQuery https://www.codexworld.com/how-to/validate-file-size-while-uploading-using-javascript-or-jquery/ https://www.codexworld.com/how-to/validate-file-size-while-uploading-using-javascript-or-jquery/#respond Fri, 07 Jul 2023 17:22:05 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=5387 It's always a good idea to add client-side validation before uploading file to the server. The client-side validation adds a great user experience to the file upload section. The file size validation can be added to the file upload field using JavaScript and jQuery. In this example code snippet, we will show you how to validate file size while uploading file using jQuery or JavaScript.

The post How to Validate File Size while Uploading using JavaScript or jQuery appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/validate-file-size-while-uploading-using-javascript-or-jquery/feed/ 0 5387
How to Show/Hide Element by Class using JavaScript https://www.codexworld.com/how-to/show-hide-element-by-class-using-javascript/ https://www.codexworld.com/how-to/show-hide-element-by-class-using-javascript/#respond Fri, 21 Apr 2023 13:24:03 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=5335 The display property is used to control the visibility of HTML elements with CSS. Sometimes we may require to change the visibility of elements dynamically in JavaScript. The element ID or class can be used to select and Show/Hide DIV using JavaScript. Use the Document:getElementsByClassName() method to show and hide element by class name using JavaScript.

The post How to Show/Hide Element by Class using JavaScript appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/show-hide-element-by-class-using-javascript/feed/ 0 5335
How to Reload Page after Specific Time (5 seconds) in JavaScript https://www.codexworld.com/how-to/reload-page-after-specific-time-5-seconds-in-javascript/ https://www.codexworld.com/how-to/reload-page-after-specific-time-5-seconds-in-javascript/#comments Wed, 02 Mar 2022 14:11:55 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=4867 The JavaScript setTimeout() method sets a timer to execute a function or specific code after a predefined time. If you want to refresh the page automatically after some specific time, the setTimeout() method is useful to do it in JavaScript. The location.reload() method helps to reload the current URL. Use these methods together to reload the page after 5 seconds using JavaScript.

The post How to Reload Page after Specific Time (5 seconds) in JavaScript appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/reload-page-after-specific-time-5-seconds-in-javascript/feed/ 1 4867
How to Scroll to an Element using JavaScript https://www.codexworld.com/how-to/scroll-to-div-element-using-javascript/ https://www.codexworld.com/how-to/scroll-to-div-element-using-javascript/#respond Tue, 15 Feb 2022 17:40:00 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=4829 Scroll to Div functionality is used to scroll the page to a specific element automatically. The page will navigate to a specific section of the page without scrolling manually. The scroll to HTML element feature can be integrated using JavaScript. Use scrollIntoView() method to scroll to an element in JavaScript.

The post How to Scroll to an Element using JavaScript appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/scroll-to-div-element-using-javascript/feed/ 0 4829
How to Get Attribute Value of the Selected Option using JavaScript https://www.codexworld.com/how-to/get-attribute-value-of-the-selected-option-using-javascript/ https://www.codexworld.com/how-to/get-attribute-value-of-the-selected-option-using-javascript/#respond Mon, 24 Jan 2022 11:13:38 +0000 https://www.codexworld.com/?post_type=how-to-guides&p=4821 Mostly, the value attribute of the option tag is used in the select box. Besides the option value, custom attributes can be defined in the option tag of the select dropdown. You can also get the custom attribute value from the select box with JavaScript. The attribute value of the selected option can be retrieved using JavaScript easily.

The post How to Get Attribute Value of the Selected Option using JavaScript appeared first on CodexWorld.

]]>
https://www.codexworld.com/how-to/get-attribute-value-of-the-selected-option-using-javascript/feed/ 0 4821