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
    收藏
    关注
    评论
  • 相关阅读:
    MYSQL数据库间同步数据
    mysqld-nt: Out of memory (Needed 1677720 bytes)解决方法
    Apache优化:修改最大并发连接数
    MySql 存储过程实例(附完整注释)
    android loadlibrary 更改libPath 路径,指定路径加载.so
    如何在ANDROID JNI 的C++中打Log
    递归转手工栈处理的一般式[C语言]
    计算机语言学习导论[C/C++]
    程序错误[C/C++]
    访问栈为什么会比访问堆快?
  • 原文地址:https://www.cnblogs.com/smiler/p/1741372.html
Copyright © 2011-2022 走看看