简体   繁体   中英

ajax.js importing issue

In index.html i imported ajax.js with the code :

$(function() {
    $('a[name!=modal][name!=skipJQuery]').click(function(){
        $('#content').load($(this).attr('href'));
        $('#content').scrollTop();

            return false;
}); });

#content is a div that load pages. The pages inside #content are not recognizing ajax.js imported on top of index.html . How can i fix this? ..to make the pages loaded inside #content recognize the ajax.js ?

Is it the click event not firing on links in the imported content? If so, maybe try using the 'on' event binder.

$("body").on("click", "a[name!=modal][name!=skipJQuery]", function(){
    $('#content').load($(this).attr('href'));
    $('#content').scrollTop();
    return false;
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM