Javascript 如何清除jquery中的特定输入字段
我有一张表格。从jQueryAjax请求中获取特定字符串后,我想通过jQueryID选择器清除表单的一些输入字段。我该怎么办 我的jQuery代码:Javascript 如何清除jquery中的特定输入字段,javascript,jquery,Javascript,Jquery,我有一张表格。从jQueryAjax请求中获取特定字符串后,我想通过jQueryID选择器清除表单的一些输入字段。我该怎么办 我的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(dat
$.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(“”)
中设置空字符串以清除其值。谢谢-D@Bhushan kawadkar