merch89 merch89 - 1 year ago 77
HTML Question

Running Jquery within a PHP function

I have a form that has form entries and submission confirmation on the same page. When submitted, currently the form entries remain when my submission message displays - so I wish to use Jquery to hide the form entries. My form has the the id of #mysubscription, can anyone spot why this form isn't clearing on submission?


if (isset($contact_form_submitted) && $contact_form_submitted) {
<p class="success"><strong><?php echo htmlspecialchars((isset($contact_form_message)) ? $contact_form_message : 'Submission successful.', ENT_QUOTES, 'utf-8'); ?></strong></p>
<script type="text/javascript">jQuery('#mysubscription').hide()</script>


Answer Source

Try this

<!--You need to load library first without library $ wont work-->    
    <script src=""></script>
    <script type="text/javascript">
      * $(function(){}) is runs the script after DOM(document object model) loaded. this equivalent to ready() function. The ready() method specifies what happens when a ready event occurs.    
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download