My Books

Text Processing with JavaScript

Solve complex text validation, extraction, and modification problems efficiently in JavaScript.

Modern Async JavaScript

Delve into async features of JavaScript from ES2020 through ESNext. Start building custom asynchronous iterators and generators, and more for fast, lean code.

JavaScript Brain Teasers

Ready to test your JavaScript skills? Challenge yourself with these brain-teasing puzzles, supercharge your learning journey, and emerge as a JavaScript pro.

This article explores different options for preserving paragraph formatting in PHP. It will show you how to display entered text in a textarea properly without the need to use the PHP nl2br function.

In JavaScript, there are several ways to count the occurrences of some text or character in a string. If you need to find the occurrences of a single character, then using the charAt() method inside a loop is the easiest method. Let's look at some examples.

There are dozens of jQuery plugins on the internet to help you create beautiful galleries. Most of them are more aesthetic than functional. This script helps you create a simple and lightweight jQuery photo gallery using unobtrusive JavaScript technique which allows users who have their JavaScript off still use the gallery.

Alternate row colors (or zebra striping) is a great way to make long lists and tables easier to read. This technique is especially useful for large tables. In PHP, we can easily change the color of every other row of this table by using a ternary operator inside a while loop.

A popular question on forums is how to create random numbers in jQuery. We don't really need to use jQuery for a simple task like this. The Math.random() method in JavaScript can be used to quickly create a random number between 0 and 1

To check if an element is visible using jQuery, you can use .is(':visible'). If you wanted to check whether an element is hidden then you would use .is(':hidden) instead.

Alternating row colors in jQuery can be easily done using :even and :odd selectors. Let's apply these selector to a list and see the effect.

In some cases you can do things with a subquery that can't be done with join. However when using subqueries, there can be performance costs.

Using css you can improve the readability of large tables. Learn how to color alternating rows in a few lines of css code without using any server-side code or javascript.