Jquery event to fire in ajax loaded content, IE & FF problem
- by Sylph
Hello,
I'm trying to trigger onclick events in an ajax loaded content but it doesn't seem to work.
Here is my code :-
<li><a href="#" id="subtopic">Title</a></li>
<script type="text/javascript">
$(function() {
$("#subtopic").click(function() {
url: test.html
,success: function(data) {
$('#result').html(data);
$(".filetree").treeview();
$('#result').click();
$('#result').trigger("update");
}
});
});
});
</script>
In my loaded content, :-
<a href="#" id="addSubTopic">Click here</a>
<script type="text/javascript">
$(document).ready(function() {
alert("000");
});
$(function() {
$("#addSubTopic").click(function() {
alert("0");
$.ajax({
url: url,
success: function(data) {
$("#listRes").append(data);
}
});
});
});
</script>
In IE, it works fine, the click works and I can get the "alert" but in Firefox, the whole thing just go dead. However, my jquery plugin for $(".filetree").treeview(); works fine for both IE and FF.
Any advice? I have tried using .live, .trigger("update").
Thanks in advance