Reputation: 7028
I have a link:
<a href="#" onClick="javascript:isRename();" class="current-text">rename</a>
which invokes isRename() function:
function isRename(){
var i = getCheckboxCount();
if(i==1){
showInputDialog(getCheckboxName(),'Rename', 'Enter the name of file/directory',null);
}
}
function showInputDialog(a,b,c,okFunc){
$.fn.InitInputDialog(a,b,c,okFunc);
$.fn.fadeInCommon();
};
It shows a modal window. This window has a close button.
$("#CloseInputButton").off('click'); //MY CLOSE BUTTON IN MODAL WINDOW
$("#CloseInputButton").click(function(){
fadeOutCommon();
});
$.fn.fadeOutCommon = function(){
//transition effect
$('#mask').fadeTo("slow",0.0,function(){
$(dialogID).hide();
$('#mask, .window').hide();
});
};
It works fine before I press the close button. My web page refreshes and fadeOutCommon animation doesn't work at all! I think it happens because of refreshing web page! How can I disable refreshing web page?
Thanks
Upvotes: 0
Views: 10418
Reputation: 176956
Just write down return false;
will do that task.
<a href="#" onClick="javascript:return isRename();" class="current-text">rename</a>
function isRename(){
var i = getCheckboxCount();
if(i==1){
showInputDialog(getCheckboxName(),'Rename', 'Enter the name of file/directory',null); }
return false;
}
Also have look to
e.preventDefault()
will prevent the default event from occuring, e.stopPropagation()
will prevent the event from bubbling up and return false will do both.
Upvotes: 3
Reputation: 21376
you can put return false
in your click methods
$("#CloseInputButton").click(function(){
fadeOutCommon();
return false;
});
Upvotes: 1