Updated the prevent default code so that it works in IE8 and below