I have a search box that helps a user locate things in our menu and it works really well except when the link is a modal link. The won't fire the modal event and I'm stuck on why that is. Here is the searchbox code:
$('#txtSearch').on('keyup', function () {
if ($(this).val() != "") {
$('#menuSearchResults').html("");
$("a.menuItem:contains('" + $(this).val() + "')").each(function () {
if ($(this).data('toggle')) {
$('#menuSearchResults').append('<a href="#" data-toggle="modal" data-target="' + $(this).data('target') + '" id="' + $(this).prop('id') + '">' + $(this).text() + '</a><br>');
} else {
$('#menuSearchResults').append('<a href="' + $(this).prop('href') + '">' + $(this).text() + '</a><br>');
}
});
} else {
$('#menuSearchResults').html("");
}
});
Everything looks correct to me so I'm at a loss why its not working.
EDIT:
Here is my click event for the button in question
$('#mnuCreateReport').on('click', function (e) {
e.preventDefault();
buildFormDialog('dlgCreateReport', 'Create Custom Report', '/form/report/create');
});