{%- comment -%} Last Update: 1-6-22 Summary: Adds search functionality to the PageListAsBlocks lava template {%- endcomment -%} {%- javascript -%} $(document).ready(function() { // Prevent async page submission triggered by enter key which breaks script, preventing submission after keyup does not work $('#pageSearch').on('keydown', function(e) { if (e.keyCode == 13) { e.preventDefault(); return false; } }); // Filter page links when Search box is updated, value of text is not updated until after keyup $('#pageSearch').on('keyup', function(e) { var value = $(this).val().toLowerCase(); $('.panel-body ul li').filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); }); }); }); {%- endjavascript -%} {%- stylesheet -%} #pageSearch { margin-bottom:15px; } {%- endstylesheet -%}
{%- include '~~/Assets/Lava/PageListAsBlocks.lava' -%}