I have a one dropdown menu so when I click on first item, I want to show DIV id=city3. and while I select another item, It will show DIV id=km automatically.
Problem : While I select first item, Div id=city3 is not visible and while I select another item, Div id=km is visible. So I want to show div id=city3 while I select first item.
Here is code.
$("#city_to").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;
if(id==1)
{
$("#city3").show();
$(".km").hide();
$(".distance").val('');
$(".allowance1").val('');
$(".hq_allowance1").val('');
$(".exhq_allowance1").val('');
$(".os_allowance1").val('');
$(".total_allowance").val('');
$(".total").val('');
}
else
{
$(".km").show();
$("#city3").hide();
$(".allowance").val('');
$(".hq_allowance").val('');
$(".exhq_allowance").val('');
$(".os_allowance").val('');
$(".total_allowance1").val('');
$(".total").val('');
$.ajax
({
type: "POST",
url: "ajax_pages/km.php",
data: dataString,
cache: false,
success: function(html)
{
$(".km").html(html);
}
});
}
});