Try using a custom event handler, like so:
$("input[name='pick_up_point']").change(function()
{
$(this).trigger("displayForm");
clearForm();
});
$("input[name='pick_up_point']").bind("displayForm", function() {
if($("input[name='pick_up_point']:checked").val() == "pick_up_airport")
{
$("#pick_up_airport_div").slideDown();
$("#start_point_div").hide();
}
});
So instead of triggering the change event, trigger the custom displayForm
handler, like this:
$('input[name='pick_up_point']').trigger('displayForm');
And now, when change
is triggered, it works as expected, but for the special case of displaying the form without clearing the input fields, you can simply trigger your new custom event handler.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…