当所有表单字段都完成时,jquery将图像添加到列表项中一次

jquery add image to list item once when all form fields are completed

本文关键字:列表 一次 添加 图像 字段 表单 完成时 jquery      更新时间:2023-12-13

例如,我在页面的左侧有4个列表项(左导航),在工作区有4个表单。

当我们点击每个列表项时,它只显示一个表单。

在这里,当所有相应的表单字段都被填充时(就像一个完整的状态),我需要每个列表项都有一个勾号(使用Jquery/JavaScript)。

在这种情况下,请使用任何jquery/javascript插件来帮助我。

You can add check-box in list and using jQuery. you can check form is completely filled by this function:
function validateForm() {
  var isValid = true;
  $('.form-field').each(function() {
    if ( $(this).val() === '' )
        isValid = false;
  });
  return isValid;
}
and when function returns true then check the corresponded check-box
$('#checkboxId').prop('checked', true);
you can add a anchor(a) tag as well as add class(having image of tick) when above function return true
I hope this would be help full.