Hello all I am experiencing some strange issue with a website and some jquery on a click event. Within IE 9 firefox and chrome this works fine. However IE 8 will not fire the click event.
This is an asp.net webform wrapped in an update panel. ]
aspx code
<asp:UpdatePanel ID="searchupdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="search" class="searchcontainer">
<asp:TextBox ID="tbsearchterm" CssClass="watermark" runat="server" />
<a href="#" class="button big left" id="btnSave">Save</a>
</div>
</ContentTemplate>
</asp:UpdatePanel>
Within my js file I have the following this code is wrapped inside of a onPageLoad function
function pageLoad() {
...
//SimpleModal Save Dialog
$(function () {
$('#btnSave').click(function (e) {
var searchtrm = $('#tbsearchterm').val();
if (searchtrm == "Enter Search Term" || $.trim(searchtrm) === "") {
$('#alert-modal-content').modal({ overlayClose: false, close: false, containerId: 'alert-container' });
$('<b>Whoops!</b><br/><br/><span>Before you can save your search you need to enter a search term or query.</span>').appendTo('#alertTerm');
}
else {
$('#txt_ssQueryText').val(searchtrm);
$('#save-modal-content').modal({ appendTo: 'form', overlayClose: false, close: false, containerId: 'saveSearch-container' });
}
});
});
}
As I said this works fine in IE 9 but 8 and lower and the click event is never even touched (verified in debugger). I have seen some other posts which suggest using the .on() event but I have tested this by even using a class selector with no luck.
tried this but it did not work (work meaning the function was never called.
$(function () {
$('.btntestclass').on('click', 'a', function (e) {
var searchtrm = $('#tbsearchterm').val();
if (searchtrm == "Enter Search Term" || $.trim(searchtrm) === "") {
$('#alert-modal-content').modal({ overlayClose: false, close: false, containerId: 'alert-container' });
$('<b>Whoops!</b><br/><br/><span>Before you can save your search you need to enter a search term or query.</span>').appendTo('#alertTerm');
}
else {
$('#txt_ssQueryText').val(searchtrm);
$('#save-modal-content').modal({ appendTo: 'form', overlayClose: false, close: false, containerId: 'saveSearch-container' });
}
});
});
Any suggestions as to why this is not executing in ie 8?
Thanks in advance