code reset form in Angularjs

 $scope.FnReset = function(){
      $("input[type='reset']").click();
          $scope.frmRg.$setPristine();
$scope.rg={};
    };
  $("input[type='reset']").on("click", function (event) {
    console.log(" *** button reset *** ");
    event.preventDefault();
    var myForm = $(this).closest('form').get(0);
    myForm.reset();
    $("select", myForm).each(
      function () {
        $(this).select2('val', $(this).find('option:selected').val())
      }
    );
  });
Boonyadol Morruchai (Senior Full-stack Developer)

ผมเป็น IT Professional ที่มีประสบการณ์ในสายงานมากว่า 20 ปี เชี่ยวชาญการออกแบบระบบ Enterprise และ Automation Tools ปัจจุบันมุ่งเน้นการประยุกต์ใช้ AI (Gemini/OpenAI) เพื่อเพิ่มประสิทธิภาพในการเขียน Code และการจัดการข้อมูลขนาดใหญ่ บล็อกนี้สร้างขึ้นเพื่อแชร์ "ประสบการณ์หน้างาน" ปัญหาจริงที่เจอ และวิธีแก้ปัญหาฉบับ Senior Dev ครับ

แสดงความคิดเห็น

ใหม่กว่า เก่ากว่า