在jquery或javascript或angular中单击单选按钮或复选框后返回呼叫

Return call after the radio button or check box is clicked in jquery or javascript or angular

本文关键字:复选框 返回 单选按钮 呼叫 jquery javascript angular 单击      更新时间:2023-09-26

我想在原始函数中完成单击后得到回调。

<input type="radio" onchange="changefun()" />
function changefun()
{
   // some code will be done here
}

在其他页面上

$(document).on('input:radio','click',function(e){
    // success means after the changefun() has completed
    if(e.success)
    {
      // some code
    }else{
      // some code
    }
}

我们在jquery中有这样的东西吗

我希望这将有助于解决您的问题。让我知道。

function changefun() {
    alert("Change Called");
}
               
$(document).ready(function(){
  $('input[type="radio"]').click(function(e){
  
    if ($(this).is(':checked'))
    {
      alert("Success");
    }
    else
      {
        alert("Fail");
      }
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<html>
  <body>
<input type="radio" onchange="changefun1()" >Select</input>
 </body>
</html>