Preview as button. Disable note submit unless content

This commit is contained in:
randx 2012-08-29 08:13:38 +03:00
parent b9b63fc362
commit e5adca1b81
2 changed files with 16 additions and 4 deletions

View file

@ -24,6 +24,16 @@ init:
$('.delete-note').live('ajax:success', function() {
$(this).closest('li').fadeOut(); });
$('#note_note').on('keyup', function(){
var field = $(this);
var closest_submit = field.closest("form").find(".submit_note");
if(field.val() == "") {
closest_submit.attr("disabled", "disabled").addClass("disabled");
} else {
closest_submit.removeAttr("disabled").removeClass("disabled");
}
})
$("#new_note").live("ajax:before", function(){
$(".submit_note").attr("disabled", "disabled");
})
@ -35,6 +45,7 @@ init:
$("#note_note").live("focus", function(){
$(this).css("height", "80px");
$('.note_advanced_opts').show();
$(this).closest("form").find(".submit_note").attr("disabled", "disabled");
});
$("#note_attachment").change(function(e){