I can't get the form to show when the button is clicked, any ideas? I have included the js file in the header. myfile.php $commentid = $commentdata['ID']; echo '<input type="button" value="'; echo _('Reply'); echo '" onclick="comNew('; echo "'".$commentdata['ID']."'"; echo ')"/>'; echo '<div id="comForm'.$commentid.'"></div>'; PHP: doit.js function comNew(parentId) { $.post("createComment.php",{pid:parentId}, function(data) { $('ComNew' + parentId).html(data); }); } Code (markup): createComment.php <?php include("db.php"); $parentid = $_POST['pid']; ?> <form action="#" method="post"> <input type="hidden" name="childcom" value="Y"> <input type="hidden" name="childcomid" value="<?php echo $parentid; ?>"> <textarea rows="10" cols="50" name="content" /><br /> <input type="submit" value="Submit" /> </form> PHP: Thanks for any help!
Nevermind, it was easier to do like this echo '<input type="button" value="'; echo _('Reply'); echo '" onclick="reply('; echo "'".$commentdata['ID']."'"; echo ');"/>'; echo '<div id="'.$commentid.'" style="display: none;">'; ?> <form action="#" method="post"> <input type="hidden" name="childcom" value="Y"> <input type="hidden" name="childcomid" value="<?php echo $commentid; ?>"> <textarea rows="10" cols="50" name="content" /></textarea><br /> <input type="submit" value="Submit" /> </form> <?php echo '</div>'; PHP: <script> function reply(id) { var state = document.getElementById(id).style.display; if (state == 'block') { document.getElementById(id).style.display = 'none'; } else { document.getElementById(id).style.display = 'block'; } } </script> Code (markup):