zoukankan      html  css  js  c++  java
  • jQuery备忘录

    jquery 中遍历数组

    var arr = [1,2,3,4,5]
    $.each(arr,function(i,j){
    console.log(i,j)
    })

    结果

    0 1

    1 2

    ....

    jQuery 中遍历字典

    let obj = {'name': 'lll', 'age': 15}
        $.each(obj, function (i, j) {
            console.log(i, j)
        })

    结果

    name lll

    age   15

    jquery 循环标签

    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
    </ul>
    <script>
        $('ul li').each(function (i, j) {
            console.log(i, j)
            console.log($(this).html())
        })
    </script>

    jquery中删除父节点

    parentEl=$(this).parent()
    parentEl.remove()

    jquery 取file类型中的值

    $("#files")[0].files[0]

      

    jquery取url中参数

    location.search 
    "?postid=1123123&update=1"
    
    
    #切去几位,后面返回
    location.search.slice(1)
    
    
    location.href
    "https://i.cnblogs.com/EditPosts.aspx?postid=1132312121&update=1"

      

    jquery 生成图片验证码请求


    var preimageCodeId = "" function generateImageCode() { //生成随机字符串 imageCodeId = generateUUID() //拼接url路径,携带随机字符串参数 image_url = "/passport/image_code?cur_id=" + imageCodeId + "&pre_id=" + preimageCodeId //设置到图片标签中 $(".get_pic_code").attr("src",image_url) //记录上一次的随机字符串 preimageCodeId = imageCodeId }
  • 相关阅读:
    NLP 基础问题及解析
    linux 命令精简
    linux 文件属性及操作
    linux 文件编辑命令vim
    NLP attention 简述
    数据结构
    2020 走进新时代
    条件随机场CRF 摘要
    linux的jdk、tomcat、tomcat安装等
    VMware所在磁盘满了、linux中date修改、ssh、eclipse的使用问题等
  • 原文地址:https://www.cnblogs.com/ls1997/p/10990973.html
Copyright © 2011-2022 走看看