Skip to content

Commit

Permalink
hide submit button if no comment typed in (#328)
Browse files Browse the repository at this point in the history
fix #105
  • Loading branch information
NovemLinguae authored Apr 23, 2024
1 parent cd748e2 commit cdb6379
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/modules/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2122,9 +2122,22 @@

function showCommentOptions() {
loadView( 'comment', {} );

var $submitButton = $( '#afchSubmitForm' );
$submitButton.hide();

$( '#commentText' ).on( 'keyup', mw.util.debounce( 500, function () {
previewComment( $( '#commentText' ), $( '#commentPreview' ) );

// Hide the submit button if there is no comment typed in
var comment = $( '#commentText' ).val();
if ( comment.length > 0 ) {
$submitButton.show();
} else {
$submitButton.hide();
}
} ) );

addFormSubmitHandler( handleComment );
}

Expand Down

0 comments on commit cdb6379

Please sign in to comment.