Try this code:
$(document).ready(function(){
$('#YourControlID').click(function(){
if() { //your condition
$.messager.show({
title:'My Title',
msg:'The message content',
showType:'fade',
style:{
right:'',
bottom:''
}
});
}
});
});