I have the following jQuery code that is giving me a problem. I have two jQuery functions that both call blockUI, and I get the same error for both. It says that blockUI is not a function. Can anybody tell me why?
function loading() {
// register on click event for buttons.
$.blockUI({
message: '<h3 class="fldHead">Loading... <img src="/app/images/winliveprog.gif"/></h3>'
});
$('body').css('cursor', 'wait');
}
$(function() {
$('[name="btnPreviewPost"]').click(function() {
console.log('btnPreviewPost clicked');
$(this).blockUI();
loading();
$.blockUI({
message: '<h3 class="fldHead">Loading... <img src="/capserver/images/winliveprog.gif"/></h3>'
});
$('body').css('cursor', 'wait');
});
$('[name="btnEditPost"]').click(function() {
console.log('btnEditPost clicked')
$(this).blockUI();
loading();
$.blockUI({
message: '<h3 class="fldHead">Loading... <img src="/capserver/images/winliveprog.gif"/></h3>'
});
$('body').css('cursor', 'wait');
});
});
Try creating it as $.fn.blockUI for calling it on jquery objects like $(this).blockUI();