zoukankan      html  css  js  c++  java
  • JQuery 小结

    1。文本框的改变事件,可使用propertychange,例如:

    $("#txtDataDate").bind("propertychange",function(){

    });
    2。获取被选中RadioButton 的值
    var radio_value = $("input[@type=radio][checked]").val();
    3。下拉列表的改变事件,以及获得选中选项的值
    $("#下拉列表").change(function() {
    //获得选中项的value值
    var select = $(this).val();
      var checkText=$("#select_id").find("option:selected").text();  //获取Select选择的Text
    

    }).change();
    4。获取下拉列表DropDownList选中的值
    var ddl = $("#ddlDiaryType option:selected").text();//下拉别表

     5。Jquery绑定同一事件时,如要只执行一个事件,需要用  $("#txt").unbind();方法卸载事件,例如:

    代码
    $("#ddlType").change(function () {
    var now = new Date();
    var ADateNow = now.getYear() + "-" + (now.getMonth() + 1);
    var select = $(this).val();
    $(
    "#txtStartTime").unbind("focus");
    $(
    "#txtEndTime").unbind("focus");
    if (select == "") {
    var ADate = ADateNow;
    $(
    "#txtStartTime").focus(function () { WdatePicker({ isShowClear: false, readOnly: true, skin: 'whyGreen', dateFmt: 'yyyy-MM' }); }).val(ADate);
    $(
    "#txtEndTime").focus(function () { WdatePicker({ isShowClear: false, readOnly: true, skin: 'whyGreen', dateFmt: 'yyyy-MM' }); }).val(ADate);
    }
    else {
    ADate
    = ADateNow + "-" + now.getDate();
    $(
    "#txtStartTime").focus(function () { WdatePicker({ isShowClear: false, readOnly: true, skin: 'whyGreen', dateFmt: 'yyyy-MM-dd' }); }).val(ADate);
    $(
    "#txtEndTime").focus(function () { WdatePicker({ isShowClear: false, readOnly: true, skin: 'whyGreen', dateFmt: 'yyyy-MM-dd' }); }).val(ADate);
    }

    }).change();
    Top
    收藏
    关注
    评论
  • 相关阅读:
    获取经纬度 CLLocation
    获取手机 IP
    UIBeaierPath 与 CAShapeLayer
    导航栏转场动画CATransition
    UITextField输入限制/小数/首位等
    程序进入后台继续执行
    发送短信
    网络AFNetworking 3.1
    UIBezierPath
    CoreAnimation 核心动画 / CABasicAnimation/ CAKeyframeAnimation
  • 原文地址:https://www.cnblogs.com/smiler/p/1741372.html
Copyright © 2011-2022 走看看