I have table with 20+ columns. Some columns have a Add link that would generate a popup in a div layer. The issue i’m having now is when I click on Add on columns that require scrolling to the right, it would create the popup but it would jump back to the first column and lose focus. How would I make sure it does not jump back to the first column and keep the focus where it was looking before click on Add?
$(function () {
var moveLeft = 15;
var moveDown = 20;
$('a.trythis').click(function (e) {
$('#popup').show().css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft).appendTo('body');
});
$('#closethis').click(function (e) {
$('#popup').hide();
});
});
In both click functions either
return falseor usee.preventDefault().This will stop the browser trying to follow the links (which are presumably
#) and just apply the javascript