jquery - 如果选中收音机,则显示消息操作
问题描述
我有一个 HTML 输入单选
<input class="payment_processor_gocardless crm-form-radio" value="5" type="radio" id="QFID_5_payment_processor_id" name="payment_processor_id">
通常不选择收音机。我想做的是,每当我点击那个收音机时,我都希望通过 sweetalert 显示一条消息。这是我的代码:
$('input[name=payment_processor_id]”]’).click(function() {
if (($("input[name=payment_processor_id]").attr("value")=="5") ) {
Swal.fire({
sweetalert message goes here
});
}
});
Sweetalert 在其他领域也很实用,所以这不是我关心的问题。选择单选按钮时我无法触发它。任何帮助,将不胜感激。谢谢
解决方案
你在做一些语义错误,在你的代码中做了修改。
$('input[name="payment_processor_id"]').click(function() {
if (($('input[name="payment_processor_id"]').attr("value")=="5") ) {
Swal.fire({
sweetalert message goes here
});
}
});
推荐阅读
- javascript - 是否可以在客户端 JavaScript 中使用 Firebase“onWrite”事件?
- chef-infra - 如何通知平衡服务
- api - Dynamics 365 Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString) 需要 15 秒才能打开
- javascript - 基于其中某些数据的 PHP/Javascript 颜色单元格
- matlab - MATLAB中的自适应椭圆结构元素
- python - 年薪和日薪分开
- download - 下载失败,因为您可能没有购买此应用 - 模拟器
- rest - 将 REST API 限制为仅限移动应用程序 - 建议的方法
- python - 在 Mac OS 上默认使用 Python 3?
- jenkins - Jenkins Multibranch Config:如何根据变量字符串过滤分支?