Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Use JQuery to show and hide help text
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ball committed Apr 3, 2019
1 parent 26c2d76 commit dfa9358
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions static/js/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,18 @@ $( ".form-list > li:last-child" )

$( "input[list='keyword-list']" ).parent().filter(":last-child")
.one( "change", autoduplicate );

/* Cleaning help text */

$( ".form-group" ).find( ".help-block" ).hide();

$( ":input" ).focus(function() {
$( this ).closest( ".form-group" ).find( ".help-block" )
.filter( ":hidden" ).show(400);
});

$( ".form-group" ).focusout(function (event) {
if ( $( this ).has( event.relatedTarget ).length == 0 ) {
$( this ).find( ".help-block" ).hide(400);
}
});

0 comments on commit dfa9358

Please sign in to comment.