By using the window.open() function of JavaScript we can popup a new browser window/tab, specify the height and width of the window to be opened, and even set whether to hide or show certain elements such as toolbars, the address bar and more. One of the other attributes we can specify is ...
jQuery’s ColorBox is one of my favourite and most used jQuery plugins. It’s simple to set up, looks great, very customisable and the website contains examples to cover every scenario you could imagine. One thing that I couldn’t achieve right away however was how to get th...
I recently wrote about how to remove all occurences of a character from a string using JavaScript by combining the replace() function and a regular expression. This works great but a problem arises when we use this method to try and replace all occurrences of a space. Using the previously ...
Favicons (meaning favourites icons) are small images that appear in the address bar, a browser tab or a bookmark when someone visits your site. They add branding and uniqueness to any website and are so simple to setup taking just minutes to generate. I want to show you just how easy they ...
Ever needed to call a function expecting parameters but use the functions default value rather than passing the same value each time? Let me give you an example: function do_something(my_var) { alert(my_var); } do_something(); In doing the above you will get ‘undefined’ output....
I know, I know… HTML tables are old school, out of date and uncool. Regardless of this fact however they will always be used on some sites and admittedly, I even use them myself in certain circumstances. I came across an issue recently however when cross-browser testing a page where ...
Generating labels on the web via an application is something I’ve come across numerous times in my career and never have I been able to find a reliable and versatile enough method for doing so. As a result I generated a library for the PHP framework CodeIgniter to handle the hundreds...
The PHP date() function is great for the majority of tasks regarding getting a date or time, however one thing it doesn’t cater for is obtaining the season. Seasons generally vary depending on the year and where you’re based in the world; While it’s Summer in the Northern...
When building an events calendar recently I needed to obtain all the dates between two dates. For others looking to do the same thing I used the code below to achieve this. Simply change the $date_from and $date_to variables to get it working for you. // Specify the start date. This date c...
The replace() function in JavaScript is useful for finding a substring within a string and replacing it with a new substring. What the official JavaScript documentation doesn’t state very clearly however is that the function will only replace the first occurrence. But what if we need...