I am having a problem with JQuery: whenever a JQuery function is called, the page refreshes whenever an if block is executed.
$(".remove").click(function() {
removeOption($(this));
});
function removeOption(obj){
if (obj.parent().siblings().size() > 1){
obj.parent().remove();
}
}
IF the (obj.parent()…) block is executed, the page refreshes. It’s not limited to the function: if I change the if (obj.parent()… ) to if (true), I have the same problem. I also have the problem if I put the removeOption(obj) as an anonymous function inside the first function. Could this be a bug in JQuery, or does anyone have any insight?
1 Answer