Loading an external .htm file into a div with javascript

Posted by Mads Friis on Stack Overflow See other posts from Stack Overflow or by Mads Friis
Published on 2012-07-01T09:10:21Z Indexed on 2012/07/01 9:15 UTC
Read the original article Hit count: 312

Filed under:
|
|

So I got this code

Javascript:

<script type="text/javascript">
$(function(){
    $('.ajax') .click(function(e){
        e.preventDefault()
        $('#content').load( 'file.htm' )
    })
})
</script>

html:

<a href="file.htm" class="ajax">Link</a>

it works perfectly in firefox, but nothing happens when I click the link in chrome and IE simply opens a new window with the file. any advice?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery