erang placeholder js

This commit is contained in:
sanj 2010-08-29 23:24:55 +05:30
parent fe50b9988e
commit 1353fc4fbb

View File

@ -3,6 +3,29 @@
{% block head %}
<title>India Theatre Forum - {{ current_issue.title }}</title>
<script type="text/javascript">
$(document).ready(function() {
$('input, textarea').each(function() {
var hasPlaceholder = $(this).attr("data-placeholder") == undefined ? false : true;
if (hasPlaceholder) {
var placeholderText = $(this).data("placeholder") = $(this).attr("data-placeholder");
$(this).addClass("placeholder").val(placeholderText);
$(this).focus(function() {
var currText = $(this).val();
if (currText == $(this).data("placeholder")) {
$(this).val('').removeClass("placeholder");
}
});
$(this).blur(function() {
var currText = $(this).val();
if (currText == '') {
$(this).val($(this).data("placeholder"));
$(this).addClass("placeholder");
}
});
}
});
});
$(document).ready(function() {
$('#subscribeForm').submit(function(e) {
e.preventDefault();
@ -93,6 +116,7 @@ $(document).ready(function() {
ul {
padding: 0px;
padding-left: 4px;
margin-top: 2px;
}
@ -110,6 +134,11 @@ $(document).ready(function() {
font-style: italic;
font-size: 10px;
}
.placeholder {
color: #808080;
font-style: italic;
}
</style>
{% endblock %}