我有一个表格。从jQuery Ajax请求获取特定的字符串后,我想通过jQuery id选择器清除表单的一些输入字段。我该怎么办 ?
我的jQuery代码:
$.post(site_url.concat('xml_request/cert.php') , { special_code:special_code , cert_id_name:cert_id_name , recive_date:sector_dob5 , about_cert:about_cert } , function(data){
$('#add_cert_feedback').html(data);
if (data.indexOf('New Certificate is now Added') !== -1) {
//Want to reset a Input field here
} else {
$('#the_heck').html('shit!');
}
$.post(site_url.concat('xml_request/cert.php') , { special_code:'_get_array_cert' } , function(data){
$('#cert_load').html(data);
});
});
您可以使用以下代码清除输入字段-
$('#inputId').val('');
我已经使用了id
选择器,您可以使用class
或任何其他选择器进行选择input
(根据您的要求)并设置空字符串.val('')
以清除其值。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句