hey guys so i have a drop down list and the options are populated from database. and i have a table where names would be populated from database when an option is selected. i have this:
<script type="text/javascript">
$(document).ready(function(){
$('#dd-event').change(function()
{
if($(this).val() != "" )
{
$('.contact-names').load('/EMS2/showUser.php');
}
else
{
var msg = '<tr><td>Please select an event</td></tr>';
$(".contact-names").append(msg);
}
});
});
</script>
the else code doesn’t seem to be working. though the table does get populated when an option is selected. but i would like to have the “PLease select an event” message be displayed so users will select an event.
i tried doing
if($(this).val() == "" )
{
var msg = '<tr><td>Please select an event</td></tr>';
$(".contact-names").append(msg);
}
else
{
$('.contact-names').load('/EMS2/showUser.php');
}
but the message isnt shown, .load() works though. what am i doing wrong?
using jquery 1.11.1.min
TIA