Created
May 9, 2012 13:31
-
-
Save hilukasz/2644515 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
//not even sure if I can do this? should I declare each var for each value? | |
var newSalesPageInputs = [$newSaleAddress = $('#newSaleAddress'), | |
$newSaleAddress = $('#newSaleAddress'), | |
$newSaleTitle = $('#newSaleTitle'), | |
$newSaleDescription = $('#newSaleDescription'), | |
$newSaleSummary = $('#newSaleSummary'), | |
$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')); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment