开始使用 文档 演示/教程 独立组件 社区
全部分类 实体操作 脚本控件

单选框控件

  用于前端,只需要绑定对象即可的实现只能选中单项且样式精简的基础控件。添加选中事件可实现选中后的操作。

RadioButton()

Contents

html代码

<head>

    <title></title>

    <link href="/_css/common.css" rel="stylesheet" type="text/css" />

    <script src="/_js/jquery-1.8.2.min.js" type="text/javascript"></script>

    <script src="/_js/Valid.js" type="text/javascript"></script>

    <script src="download.js" type="text/javascript"></script>

</head>

<body>

<div class="com_table">

   <b class="radio" _txt="1"></b>

   <b class="radio" _txt="2"></b>

   <b class="radio" _txt="3"></b>

</div>

</body>

init()

初始化对象

示例:

$(document).ready(function () {
   $('.com_table .radio').each(function (i, item) {
      var radio = new RadioButton();
      radio.obj = $(this);
      radio.init();
   })
})

展示效果:

click_callback()

选择事件

示例:

$('.com_table .radio').each(function (i, item) {
   var radio = new RadioButton();
   radio.obj = $(this);
   //选择事件
   radio.click_callback = function () {
   alert("已选择该项");
   }
   radio.init();
})

展示效果:

开始使用| 文档| 演示/教程| 独立组件| 社区 闽ICP备11018153号-5 Copyright © 2016 - 2017 tiaoceng.com All Rights Reserved