This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It works kinda like the asp.net's String.Format, meaning that you use {n} templates, | |
// {0} = your first argument (after the selector), {1} your second (after the selector) etc. | |
!function($, undefined) { | |
$.format = function(selector) { | |
var sel, args = arguments; | |
sel = selector.replace(/{\d}/g, function(part) { | |
var i = parseFloat( part.replace(/{|}/g, '') ); | |
return typeof i === 'number' ? args[i+1] || '' : ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
// Clone HTML5's placeholder attribute functionality | |
$('input[placeholder]').each(function() { | |
// Make sure we cache the selector to fasten up the process | |
var $t = $(this); | |
// Store the placeholder text and then set the element's value | |
// TODO: Check to make sure value is empty before setting here | |
$t.data( 'placeholder', $t.attr('placeholder') ); | |
$t.val( $t.data('placeholder') ).addClass('placeholder'); |
NewerOlder