Skip to content

Instantly share code, notes, and snippets.

View vickyRuiz's full-sized avatar

Vicky Ruiz vickyRuiz

View GitHub Profile
$('form :input').each(function(index, elem) {
var eId = $(elem).attr('id');
var label = null;
if (eId && (label = $(elem).parents('form').find('label[for='+eId+']')).length === 1) {
$(elem).attr('placeholder', $(label).html());
@ardysnippets
ardysnippets / gist:2027415
Created March 13, 2012 07:26
CSS: Cross-browser gradient
background: #40464e;
background-image: -khtml-gradient(linear, left top, left bottom, from(#40464e), to(#2d333b));
background-image: -moz-linear-gradient(top, #40464e, #2d333b);
background-image: -ms-linear-gradient(top, #40464e, #2d333b);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #40464e), color-stop(100%, #2d333b));
background-image: -webkit-linear-gradient(top, #40464e, #2d333b);
background-image: -o-linear-gradient(top, #40464e, #2d333b);
background-image: linear-gradient(top, #40464e, #2d333b);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#40464e', endColorstr='#2d333b', GradientType=0);
@makeusabrew
makeusabrew / label-to-placeholder.js
Created May 22, 2011 18:32
Simple jQuery snippet to convert form labels into inline placeholders
$("form :input").each(function(index, elem) {
var eId = $(elem).attr("id");
var label = null;
if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) {
$(elem).attr("placeholder", $(label).html());
$(label).remove();
}
});