Solution 10
PHP, Javascript, HTML, CSS, Life.
PHP, Javascript, HTML, CSS, Life.
Apr 10th
Hoping to make this a fairly regular thing, I’ll try and post little code bits and pieces every other weekend or so. Things like jQuery plugins, maybe some Kohana modules, maybe the odd CSS trick.
I’ve been pretty ill this weekend, but have fished out something from my personal stash you might like; a quick jQuery plugin that aims to replicate the HTML5 attribute “placeholder“.
Dead simple to use, simply include the script, change your input[type=text]’s and textareas to include the placeholder=”" attribute and then do :
$('input[type=text], textarea').placeholder();
In your document ready function ($(function())).
Want it? Head on over to GitHub to download:
Download Placeholder More >Feb 28th
Here’s a quick little tip that I discovered today about Javascript.
I’m currently writing a small in-context help addon for jQuery and wanted to add the option to specify a class name to give a help bubble. I did this using a setting and checked for it like such:
if(settings.class != null)
{
bubble.addClass(settings.class);
}
This works great in Firefox, Opera, Chrome and even IE but throws an error in Safari.
It took me a while to figure out what was going on but I finally figured out that ‘class’ is a reserved word in Safari Javascript. Changing the code to:
if(settings.classname != null)
{ More > Feb 28th
Figured that I should become one of the cool kids and get myself a blog set up. I’ll be posting on a potentially semi-regular permanent basis on things web dev, gaming and anything else that crosses my mind. Hope you enjoy.