Created
May 9, 2012 19:40
-
-
Save hilukasz/2648271 to your computer and use it in GitHub Desktop.
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
var newSalesPageInputs = [var $newSaleAddress = $('#newSaleAddress'), | |
var $newSaleTitle = $('#newSaleTitle'), | |
var $newSaleDescription = $('#newSaleDescription'), | |
var $newSaleSummary = $('#newSaleSummary'), | |
var $newSaleItems = $('#newSaleItems')]; | |
for(var i = 0; i < newSalesPageInputs.length; i++) { | |
alert(i); | |
$newSalesPageInputs[i].focus(function () { | |
$newSalesPageInputs[i].attr('data-value', $newSalesPageInputs[i].val()); | |
$newSalesPageInputs[i].val(''); | |
}); | |
$newSalesPageInputs[i].blur(function () { | |
if ($newSalesPageInputs[i].val().length === 0) { | |
$newSalesPageInputs[i].val($newSalesPageInputs[i].attr('data-value')); | |
} | |
}); | |
} | |
// this is based on this code: | |
// don't want to do this for EVERY variable, but I guess I could set a class instead of an ID? | |
$searchAddress.focus(function () { | |
$searchAddress.attr('data-value', $searchAddress.val()); | |
$searchAddress.val(''); | |
}); | |
$searchAddress.blur(function () { | |
if ($searchAddress.val().length === 0) { | |
$searchAddress.val($searchAddress.attr('data-value')); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment