Safari Mobile breaks jquery.live()

The live() method of jQuery is a blessing for dynamic interfaces. It allows you to attach events to dynamically created elements.

Say you want to create a dynamic menu based on some live data read from a server. Maybe you want to create some HTML like this:

<nav>
<ul>
	<li id="nav1" class="btn">item1</li>
	<li id="nav2" class="btn">item1</li>
	<li id="nav3" class="btn">item1</li>
	<li id="nav4" class="btn">item1</li>
</ul>
</nav>

With jQuery you can dynamically generate clickable elements like this:

$(".btn").live("click", function(){
var elem = event.target.id;
alert("you clicked: " + elem);
});

This works well in the desktop and in every browser but on Mobile Safari it fails.

A workaround is to deliberately add an “onclick” attribute to the element you want to attach the event:

<ul>
	<li id="nav1" class="btn" onclick="">item1</li>
</ul>

Lost Season 6 Posters

Lost Season 6 - Everybody Loves Hugo episode

The work from Ty Mattson is amazing. I love the collection of Black and White posters created for each episode of the last season of the Lost TV series. What really strikes me is how Mattson captured the essence of each episode with his illustrations. The illustration above is for episode 11 – “Everybody Loves Hugo”. You can check the other ones in his blog.