zoukankan      html  css  js  c++  java
  • js

    //引入jquery 框架
    <script src="/style/js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
        //初始化-1
        $(document).ready(function() {     


       })
      //或者初始化-2
    jQuery(function(){


    })


    $.getScript("c.js");//引入js脚本
    </script> 


    //select option
        $('.cpLogo').change(function(){
            var url = $(this).children('option:selected').attr('data-url');
            var url2 = $('.cpLogo option:selected').attr('data-url');
            var val = $(this).val();
        })


    //checkbox 全选 & 取消全选
    $('#ckbAll').click(function(){
           $("input[name='ckbOption[]']").prop("checked",$(this).prop('checked'));
     })
    //验证checkbox 选中
    $("input[name='ckbOption[]']:checked").length;


    //radio 选中的值
     $("input[name='templet']:checked").val();
    //radio 赋值
    $("input[name='templet'][value=1]").prop("checked",true);


    //判断元素是否存在
    $('#id').length     或者  document.getElementById('id')


    //多个对象绑定单个事件
    $('#setupButton,#msgButton,#avatarButton').bind('click',function(){})


    //单个对象绑定多个事件
    $('#setupButton').bind('click mouseover',function(){})


    //serialize 表单提交
    $.post("i.php",$('#form').serialize(),function(data){ })
  • 相关阅读:
    Coursera Algorithm II PA2 Q2
    Coursera Algorithm Part II PA2
    实现 memcpy 函数
    超人
    Proxy 模式
    【6】锋利的 jQuery 笔记
    【3】Chrome 的一些常用操作
    HTML 待解决与已解决问题
    CSS 待解决问题
    JS 一些常用技巧
  • 原文地址:https://www.cnblogs.com/fonyer/p/8871439.html
Copyright © 2011-2022 走看看