[jQuery] onclick event on <a href calls a function , where to return false to prevent redirection
function buildingedit(searchhtmlid, filename, editid, idnum, addnum,
obj)
{
//closeinst(searchhtmlid);
var params = $.evalJSON('{'+editid+':'+idnum+',add:'+addnum
+',showhtml:2}');
var myelem = document.getElementById('lastid');
var lastid = myelem.value;
var $tablerow = $(searchhtmlid+idnum).clone(true);
$(searchhtmlid+lastid).css('background-color','#FFFFFF');
if(lastid)
{
if(lastid!=idnum)
{
$.get(filename,
params,
function(returned_data)
{
var rs = $('<div id="editwindow" style="display:none;"></
div>');
$(searchhtmlid+idnum).hide();
$(searchhtmlid+idnum).after(rs);
//$(searchhtmlid+idnum).css('background-color','#DCE4F5');
$('#editwindow').css('background-color','#DCE4F5');
rs.html(returned_data);
rs.fadeIn(2000, function(){
$(this).css('display','block');
});
});
myelem.value = idnum;
setTimeout("prepareForm("+idnum+")", 2000);
}
else
{
$('div#editwindow').fadeOut(1000, function(){
$(this).remove();
$(searchhtmlid+idnum).show();
});
myelem.value = 0;
//closeprev(obj);
}
}
else
{
$.get(filename,
params,
function(returned_data)
{
var rs = $('<div id="editwindow" style="display:none;"></
div>');
$(searchhtmlid+idnum).hide();
$(searchhtmlid+idnum).after(rs);
//$(searchhtmlid+idnum).css('background-color','#DCE4F5');
$('#editwindow').css('background-color','#DCE4F5');
rs.html(returned_data);
rs.fadeIn(2000, function(){
$(this).css('display','block');
});
});
myelem.value = idnum;
}
return false;
}
and this is called here
<a class="ToggleClose" onClick="buildingedit('#descr',
'descriptionsadd.php', 'did', <?= $did ?>, 2, this);"
href="descriptionsadd.php?add=2&did=<?= $did ?>&showhtml=2" ></a>