how to hide message when option changes in drop down menu
<p>Hi Below I have piece of code where it displays a message stored in another php page using jquery and a html div tag known as <code>'targetdiv</code>:</p>

<pre><code> function submitform() {    

    $.ajax({
        type: "POST",
        url: "updatestudentsession.php",
data: { 
    Idcurrent:  $('#currentid').val(),
    addtextarea:   $('#studentadd').val()
},
        dataType:'json',  //get response as json
        success: function(result){
                    if(result.errorflag){

       //do your stuff on getting error message
      var newHtml="&lt;span style='color: red'&gt;"+result.msg+"&lt;/span&gt;"; 
      $("#targetdiv").html(newHtml);  //i am displaying the error msg here

    }else{
       //you got success message

       var newHtml="&lt;span style='color: green'&gt;"+result.msg+"&lt;/span&gt;"; 
            $("#targetdiv").html(newHtml);

    $('#targetdiv').show();
        }
    }
  });        
}
</code></pre>

<p>Now what I am trying to do is that if the user has selected from a drop down menu after that message has appeared, I want it to hide the message. The problem is that when I try to do this, the message does not appear even if I submit the form it does not show the message. My question is how am I suppose to hide the message in the <code>#targetdiv</code> tag when option changes but still be able to show the message after the user has submitted the form?</p>

<p>Below is what I tried to do:</p>

<pre><code>     $(document).ready( function(){

        $('#sessionsDrop').change( function(){

            $('#targetdiv').hide();
            var search_val = $(this).val();

    });

});
</code></pre>
