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



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

<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>

最新更新