I have a main page on which I loaded another page using ajax when the document is ready, there is also a button when I click "I". I am showing a warning and I have this button on the second page. but when I click on it on this page, the code does not work? how can i solve this problem?
because I do not want to repeat js codes
on the second page?
here is my first page code:
first page code:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<div class="captcha" style="border:1px solid red;">
</div>
<div class="details1">cccc</div>
<script>
$(document).ready(function(e) {
$(".captcha").load("/secondpage.htm");
$(".details1").click( function()
{
alert('button clicked');
}
);
});
</script>
</body>
</html>
and this is my second page that I loaded into the div with the captcha class name:
second page code:
<html>
<head>
</head>
<body>
<section class="details1"> Details </section>
</body>
</html>
source
share