I’m having a problem getting a function to call when I click a button. The code I’m using is shown below, and has worked on other pages, which is why I’m confused. Could it be because this code is part of a new page written over the old using Document.write(NewPage), where new page is essentially a php document returned from an ajax post?
<div class="abSpec" id="intro" style="display: block; text-align: center;">
<p>Some text</p>
<input type="button" name="proceed" id="proceed" value="Proceed"/>
</div>
<script>
$(function(){
$("#proceed").click(function(){
document.getElementById('intro').style.display="none";
}
}
</script>
I don’t like asking a debug question, but I’ve tried everything I can think of.
Thanks.
document.writecan only be used during the initial page load. See In JavaScript code after document.write() is not executed why?