jquery reset form help

i am trying to find a way to reset a div in a form. the div is #message and the code i am using at the moment is clearing the fields but not the message. if someone could show me how to do this i would be grateful as i need to find a solution quickly. many thanks

// Feedback form

jQuery(document).ready( function() {



  function feedbacknew() 
	    autoOpen: false,
	    resizable: false,
	    modal: true,
		show: 'slide',
	    title: 'Submit a feedback request',
	    width: 460,
	    height: 490    		
	$('#submit').click(function () 
	    var name = $('.uname').val();
		var email = $('.email').val();
		var position = $('.position').val();
		var feedback = $('.feedback').val();
	    var data = 'uname=' + name+email+position+feedback;
		type: "POST",
		url: "feedback.php",
		data: data,
		success: function (data) {
	    return false;


// Feedback form
<div id="form" style="display:none;">
  <form method="post" id="feedback" class="webform" name="feedback">
		<label for="company">Company</label>
		<select name="company">
		  <option SELECTED VALUE="">Select an option</option>
		  <option value="Technical">Technical</option>
		  <option value="Database">Database</option>
		  <option value="Error">Error</option>
		  <option value="Other">Other</option>
		<label for="name">Full Name:</label>
		<input id="uname" name="uname"  type="text" class="text ui-widget-content ui-corner-all inputbox uname" value="<?php echo $_SESSION['kt_name_usr']; ?>" />
		<label for="email">Email address:</label>
		<input id="email" name="email" type="text" class="text ui-widget-content ui-corner-all inputbox email" value="<?php echo $_SESSION['kt_email_usr']; ?>"/>
		<label for="position">Position:</label>
		<input id="Position" name="Position" type="text" class="text ui-widget-content ui-corner-all inputbox position" />
		<label for="Feedback">Feedback:</label>
		<textarea name="Feedback" cols="25" rows="3" type="text" class="text ui-widget-content ui-corner-all inputbox feedback" />Please make sure that any error messages or numbers are listed here.</textarea><br />
   	 	<button id="submit" class="submit">Submit</button>
		<div id="message"></div>

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gurvinder Pal SinghCommented:
so, you are trying to say that this line

is not setting the data correctly to the div with id message?

can you alert the message to see what is response coming?
peter_coopAuthor Commented:
hello. the message is appearing ok but when i close the form the message is still there when i reopen. i need a way to reset the #message when the form closes. thanks
Gurvinder Pal SinghCommented:
how do you close the form?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

peter_coopAuthor Commented:
by clicking the X in the top right part of the dialog window. thanks
Gurvinder Pal SinghCommented:
you need to capture onbeforeclose and clear that div


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
peter_coopAuthor Commented:
how that relate to my code please. thanks
Gurvinder Pal SinghCommented:
apparently you are using the jquery modal dialog plugin, and no where do i see that you are capturing the click on that close button at the right top. You have to capture that event to clear the message
peter_coopAuthor Commented:
i am new to jquery and would be grateful if you could help with this? i would be willing to raise the points. thanks
Gurvinder Pal SinghCommented:
all you have to do is check the example in the link that i shared
peter_coopAuthor Commented:
i did that bit do not understand it. for example, from the code

$( ".selector" ).dialog({
   beforeClose: function(event, ui) { ... }

what is event, ui and what goes in between {...}? thanks
peter_coopAuthor Commented:
got it. so you use like this:

beforeclose: function(event, ui) { $("#message").html(""); }
peter_coopAuthor Commented:
thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.