soltek Posted January 7, 2012 Share Posted January 7, 2012 Hey guys, I've been using JQuery for the last week (amazing stuff) and I've come to a problem. What I did is this: »A page with two buttons, each of them grabs another file from the server and display it on the div bellow. This using the .load function. (just like an old iframe) That .load function loads a table that one has one toggle action. When you click on each row, it would slideDown another div. And here's the problem, everything works fine, the .load and the slideDown, but after loading the content, the slideDown doesn't work anymore. I think the problem is that the loaded page isn't being affected by the JS code contained in the header. As a test I made a simple hide-on-click on that page and that didn't work either. So, my question is, after the page is .load(ed), I can't grab the content from the page where it is being loaded? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/254550-js-not-being-applied-on-loadded-content/ Share on other sites More sharing options...
Vel Posted January 7, 2012 Share Posted January 7, 2012 Unless it's a function the Javascript executes with what's already on the page. If you load something new in Javascript doesn't recognise it. What you need to do is include the relevant Javascript at the bottom of your "other file", the one being called by Ajax. Without seeing your code I can't offer any more advice than that. Quote Link to comment https://forums.phpfreaks.com/topic/254550-js-not-being-applied-on-loadded-content/#findComment-1305305 Share on other sites More sharing options...
trq Posted January 7, 2012 Share Posted January 7, 2012 See .on() http://api.jquery.com/on/ Quote Link to comment https://forums.phpfreaks.com/topic/254550-js-not-being-applied-on-loadded-content/#findComment-1305384 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.