jquery not fire in ajax page
hi ,
I ve problem using jquery here code in my application.rhtml as,
<html>
<head>
<%=javascript_include_tag :defaults , :cache => true%>
</head>
<body>
<%=yield%>
</body>
</html>
in index.rhtml I writen a script,
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
alert("Working");
$("p").toggle();
});
});
</script>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button type="button">Click me</button>
in ajax.rhtml
<%=link_to_remote "Click", :update=>"add" ,:url=>{:action=>:index}%>
<div id="add" />
when jquery fire I call index.rhtml page directly. The jquery event not fired when I update index.rhtml page from ajax.rhtml page.
I cannt get any reason, may i know wats pbm in it.
Thanks in advance.