I want to apply below script to create the next button on a popup. When I used the code to open the popup, it works properly. But when trying to apply the code to create the next button, it does not work. Please help me to fix the issue.
Here the script I used.
<script>
$(document).ready(function() {
$(".getAssignment").click(function() {
var $divs = $(this).parent().find(".modalDialog");
if ($divs.length > 0) {
window.location.href = "#" + $divs[ Math.floor(Math.random() * $divs.length) ].id;
}
});
});
</script>
<input class="getAssignment" type="button" value="Open Modal">
<div id="openModal" class="modalDialog">
<div>
<input class="getAssignment" type="button" value="Next">
<a href="#close" title="Close" class="close">X</a>
<h2>Modal Box</h2>
<p>This is a sample modal box that can be created using the powers of CSS3.</p>
<p>You could do a lot of things here like have a pop-up ad that shows when your website loads, or create a login/register form for users.</p>
</div>
</div>