$(document).ready(function(){
$("input[name=discount]").each(function(){
$(this).click(function(){
var discount = $(this).val();
if(discount=="0"){
$(".discount").css("display","none");
}
if(discount=="1"){
$(".discount").css("display","inline");
}
});
});
});

监听点击事件,根据不同值做不同回应

var discount=$("input[name=discount]:checked").val();

获取当前选中的radio的值

jquery 监听radio选中,取值的更多相关文章

  1. jquery怎么获取radio选中的值

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. Jquery操作单选按钮(Radio)的取值赋值实现代码

    1.获取选中值,三种方法都可以: $('input:radio:checked').val(); $("input[type='radio']:checked").val(); $ ...

  3. jquery遍历的radio的取值问题

    html页面:<c:if test="${courseStandardVos != null }"> <c:set var="index" v ...

  4. JQuery select与radio的取值与赋值

    radio 取:$("input[name='NAME']:checked").val(); 赋:$("input[name='NAME'][value='指定值']&q ...

  5. jQuery如何获得select选中的值?input单选radio选中的值

    jQuery取得select选中的值 本来以为jQuery("#select1").val();是取得选中的值, 那么jQuery("#select1").te ...

  6. jQuery对html元素的取值与赋值实例详解

    jQuery对html元素的取值与赋值实例详解 转载  2015-12-18   作者:欢欢   我要评论 这篇文章主要介绍了jQuery对html元素的取值与赋值,较为详细的分析了jQuery针对常 ...

  7. 浅谈jquery关于select框的取值和赋值

    浅谈jquery关于select框的取值和赋值   jQuery("#select_id").change(function(){}); // 1.为Select添加事件,当选择其 ...

  8. jquery 监听所有锚点链接实现平滑移动

    jquery 监听所有锚点链接实现平滑移动,地址栏上不会改变链接地址 //监听所有锚点链接实现平滑移动 $('a[href*=#],area[href*=#]').click(function() { ...

  9. jQuery监听事件经典例子

    关键字:jQuery监听事件经典例子  js代码:  ============================================================  $(function( ...

随机推荐

  1. 解决cocopods不提示第三方库名字的方法

    在使用第三方类库时,使用cocoaPods是非常方便的,具体使用方法可以参考:CocoaPods安装和使用教程 的安装使用方法.今天讨论的问题是,我在使用的时候遇到了一些问题:用cocoaPod si ...

  2. bzoj 2875: [Noi2012]随机数生成器

    #include<cstdio> #include<iostream> #include<cstring> #define ll long long using n ...

  3. 将从数组中取到的字符串赋值给了UIImage导致的错误

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantStr ...

  4. OpenResty 安装及使用(第一篇安装)

    OpenResty搭建 1.openResty介绍 OpenResty (也称为 ngx_openresty)是一个全功能的 Web 应用服务器.它打包了标准的 Nginx 核心,很多的常用的第三方模 ...

  5. 【LeetCode OJ】Path Sum II

    Problem Link: http://oj.leetcode.com/problems/path-sum-ii/ The basic idea here is same to that of Pa ...

  6. 部分用到的python代码

    replace file extensions # change .htm files to .html for file in *.htm ; do mv $file `echo $file | s ...

  7. JS几种table切换

    1.使用className <!doctype html> <html lang="en"> <head> <meta charset=& ...

  8. sql语句与 数据库

    create  table  wyx( xh int primary key, xm varchar(20) not null, nl int, zcrq timestamp default curr ...

  9. LeetCode 【21. Merge Two Sorted Lists】

    Merge two sorted linked lists and return it as a new list. The new list should be made by splicing t ...

  10. 使用 dynamic 标记解析JSON字符串

    string jsonStr = "{\"data\": {\"ssoToken\": \"70abd3d8a6654ff189c482fc ...