Clear a Flare HTML5 Search Field with the Escape Key

If you want the search field in Flare HTML5 output to clear when escape is pressed, add the following to the toolbar JavaScript.

window.onload = function() {
    $("#search-field").keyup(function (e) {
        if (e.keyCode == 27) { $("#search-field").val(""); }
    });
}

If there is already a window.onload assignment, just add the inner part to the existing assignment.

Resources:

 

2 comments

  1. Hi Tom,
    Great post, thank you. Can you please let me know to access the toolbar JavaScript? I’m still fairly new to Flare.

    Regards,
    Steve

    1. Thanks for reading!

      There is a help topic online and in the application.
      http://webhelp.madcapsoftware.com/flare11/Content/Skins/More_About_Skins/Specifying_Web_Toolbar_Settings_for_HTML5_Output.htm

      Other resources are listed on MadCap’s website.
      http://www.madcapsoftware.com/resources/

      There is also a JavaScript chapter in the companion book to this blog.
      http://xmlpress.net/publications/flare/

Leave a comment

Your email address will not be published.

HTML tags are not allowed.

253,909 Spambots Blocked by Simple Comments