jquery中的$().each和$.each的区别

注意:jquery中的$().each和$.each的区别,前者只能遍历数组,后者可以遍历数组和对象

备注:sinobook项目中地名本体相关地按类型分类,后台包的是一个map(key是关系类型,value是一个list),前台可用上述方式输出

输出

var map = {
 地名: ["北京","天津","上海"],
 民族: ["汉族","藏族","维吾尔族"]
};

$.each(map,function(key,values){
 console.log(key);
 $(values).each(function(){
  console.log("t" + this);
 });
});

地名
  北京
  天津
  上海
民族
  汉族
  藏族
  维吾尔族

jquery中的$().each和$.each的区别的更多相关文章

  1. jQuery中的bind() live() delegate()之间区别分析

    jQuery中的bind() live() delegate()之间区别分析 首先,你得要了解我们的事件冒泡(事件传播)的概念,我先看一张图 1.bind方式 $('a').bind('click', ...

  2. 深入理解jQuery中live与bind方法的区别

    本篇文章主要是对jQuery中live与bind方法的区别进行了详细的分析介绍,需要的朋友可以过来参考下,希望对大家有所帮助 注意如果是通过jq添加的层和对象一定要用live(),用其他的都不起作用 ...

  3. jQuery中attr和prop方法的区别说明

    jquery中attr和prop的基本区别可以理解为:如果是内置属性,建议用prop,如果是自定义的建议用attr. 例如 <input type=check  node=123 id=ck & ...

  4. jQuery中attr和prop方法的区别

    jQuery中attr和prop方法的区别。 http://my.oschina.net/bosscheng/blog/125833 http://www.javascript100.com/?p=8 ...

  5. jquery中的this与$(this)的区别总结(this:html元素)($(this):JQuery对象)

    jquery中的this与$(this)的区别总结(this:html元素)($(this):JQuery对象) 一.总结 1.this所指的是html 元素,有html的属性,可用 this.属性  ...

  6. jquery中this与$(this)的用法区别

    jquery中this与$(this)的用法区别.先看以下代码: $("#textbox").hover( function() { this.title = "Test ...

  7. jquery 中 html与text函数的区别

    jquery 中 html与text函数的区别 共同点:它们都能讲函数中的参数渲染到页面中: 异同点: text() 只是简单的讲参数的内容写入到页面中: html() 会根据参数的值,判断是否字体符 ...

  8. 前端开发入门到进阶附录一【JQuery中parent(),parents(),parentsUntil()区别和使用技巧】

    JQuery中parent(),parents(),parentsUntil()区别和使用技巧:https://blog.csdn.net/china1223/article/details/5193 ...

  9. JQuery中$.each 和$(selector).each()的区别详解

    PS:晚上在写页面时,发现了一个问题,$.each 和$(selector).each()有哪些区别?百度搜索关键词,首页显示出来一些前人的经验,总结一下,发上来. 1.$(selector).eac ...

随机推荐

  1. Leetcode 856. Score of Parentheses 括号得分(栈)

    Leetcode 856. Score of Parentheses 括号得分(栈) 题目描述 字符串S包含平衡的括号(即左右必定匹配),使用下面的规则计算得分 () 得1分 AB 得A+B的分,比如 ...

  2. 对drf序列化器的理解

    序列化: 将对象的状态信息转换为可以存储或传输的形式的过程.(百度定义) 对应到drf中,序列化即把模型对象转换为字典形式, 再返回给前端,主要用于输出 反序列化: 把其他格式转化为程序中的格式. 对 ...

  3. lexical or preprocessor issue file not found in Xcode

    The very last suggestion is all I needed to fix this issue. Close & re-open Xcode.

  4. C#使用Redis的基本操作

    一,引入dll 1.ServiceStack.Common.dll 2.ServiceStack.Interfaces.dll 3.ServiceStack.Redis.dll 4.ServiceSt ...

  5. sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

    使用root 登录,然后执行: chown root:root /usr/bin/sudo chmod 4755 /usr/bin/sudo reboot

  6. python PIL库的使用

    )PIL可以做很多和图像处理相关的事情: 图像归档(Image Archives).PIL非常适合于图像归档以及图像的批处理任务.你可以使用PIL创建缩略图,转换图像格式,打印图像等等. 图像展示(I ...

  7. 动态时间规整DTW(Dynamic Time Warping )

    动态时间规整DTW(Dynamic Time Warping ) 原文:https://blog.csdn.net/raym0ndkwan/article/details/45614813 算法笔记- ...

  8. Clarke Award for Imagination in Service to Society刘慈欣演讲

    刘慈欣不无批评地写道(http://cn.chinadaily.com.cn/2018-11/12/content_37243853.htm): 科幻的想象力由克拉克的广阔和深远,变成赛博朋克的狭窄和 ...

  9. PyCharm+cmd中使用Anaconda 与 新建Python环境(Windows)

    PyCharm配置Anaconda Anaconda的安装在网上已经有了,这里主要讲之前已经安装了已经配置好Python环境变量以及PyCharm的情况下,使用Anaconda. 即在PyCharm中 ...

  10. php+windows环境安装

    1.下载并安装phpstorm 2.查找激活码激活phpstorm 3.由于php官方没有提供exe版本,安装phpstudy,获得windows下exe编译版本的php 4.安装VisualSVN ...