Wednesday, 21 August 2013

Clone section not allowing jQuery from original page to fire

Clone section not allowing jQuery from original page to fire

I have a page that I am using to store some assets I need to load on other
pages with jQuery. One section of that page in particular has an inline
script that I needed to pull to another page. I am also executing a click
event on the title of that page:
$('.blogList.archive > ul > li > h2.postTitle').click(function() {
$(this).toggleClass('expand');
});
The method I am using to pull the section mentioned has an inline script
so I used this method to get the section from the page:
$.get('assets.html', function(data) {
$('#sidebar').html($('<section></section>').html(data).find('.sidebar').clone());
});
The first function (.toggleClass) is working fine on the assets page, but
when I clone it, the function no longer works.
I am working on this, but cannot find a solution. Any help here would be
greatly appreciated!

No comments:

Post a Comment