Skip to content Skip to footer
Phil's Blog Logo Phil's Blog Logo
Menu
  • Blog Home

Tag: HTML5

JavaScript

Adding Zeros to the front of a number in JavaScript.

September 7, 2024 / September 7, 2024 by Philip Newman | Leave a Comment

To format a number to always have six characters, including leading zeros if necessary, you can use JavaScript’s padStart method. This method pads the current string with another string (repeated, if needed) until the resulting string reaches the desired length. Here’s a simple example of how to do this: Explanation: You can use this function […]

Read more »

HTML5 JavaScript

JavaScript

Change the Text of a Div Element using JavaScript

December 23, 2022 / December 23, 2022 by Philip Newman | Leave a Comment

Use the textContent property to change the text of a div element, e.g. div.textContent = 'Replacement text'. The textContent property will set the text of the div to the provided string, replacing any of the existing content. Here is the HTML for the examples in this article. index.html And here is the related JavaScript code. index.js We used the textContent property on the div to change its text […]

Read more »

HTML5 JavaScript
Sidebar

Recent Posts

  • How to add .webp image support into WordPress.
  • List of commonly used PHP Extensions
  • How to connect to SFTP using PHP8.3.
  • Verify a reCAPTCHA using PHP 8.3
  • What is PHP?

Categories

  • Dovecot
  • Dribble
  • JavaScript
  • Linux
  • PHP
  • Postfix
  • WooCommerce
  • Wordpress
© 2026 Phil's Blog