从奥鹏一个答案提取页面 看jquery知识点
想要提取页面上 选定答案的 并且打印到控制台
var answer=''; $('.TestItemBody').each(function(i){var txt=$(this).children(":last").text().match(/([A-Z]+)/g)[0]; answer+=txt; if((i+1)%5==0)answer+=' '; if($(this).parent().attr('id')=='divSection2')answer+=' '; });console.log(answer); var answer=''; $('.TestItemBody').each(function(i){ $(this).children().find("input").each(function(j){ if($(this).attr("checked"))console.log(i+" "+j+" "+$(this).attr("checked",true)[0].nextSibling.nodeValue);}) }) var answer=''; $('.TestItemBody').each(function(i){ $(this).children().find("input").each(function(j){ if($(this).attr("checked")){ var ans= $(this).attr("checked",true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0]; answer+=ans; } }); if((i+1)%5==0)answer+=' '; if($(".myCourseNavOver").text().lastIndexOf("多选题")!=-1)answer+=' '; }); console.log(answer); var answer = ''; $('.TestItemBody').each(function(i) { $(this).children().find("input").each(function(j) { if ($(this).attr("checked")) { var ans = $(this).attr("checked", true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0]; answer += ans; } }); if ((i + 1) % 5 == 0) answer += ' '; if ($(".myCourseNavOver").text().lastIndexOf("多选题") != -1) answer += ' '; }); console.log(answer); // jquery 方式获取radio的 文本值 $(this).attr("checked", true)[0].nextSibling.nodeValue; //只取 字母部分 $(this).attr("checked", true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0]; var answer=''; $('.TestItemBody').each(function(i){ $(this).children().find("input").each(function(j){ if($(this).attr("checked")){ var ans= $(this).attr("checked",true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0]; answer+=ans; } }); if((i+1)%5==0)answer+=' '; if($(".myCourseNavOver").text().lastIndexOf("多选题")!=-1)answer+=' '; }); console.log(answer); 多选题: ABC ABCD AB ABC CD ABC AD AB C BCD var answer=''; $('.TestItemBody').each(function(i){ $(this).children().find("input").each(function(j){ if($(this).attr("checked")){ var ans= $(this).attr("checked",true)[0].nextSibling.nodeValue.match(/([A-Z]+)/g)[0]; answer+=ans; } }); if((i+1)%5==0)answer+=' '; if($(".myCourseNavOver").text().lastIndexOf("多选题")!=-1)answer+=' '; }); console.log(answer); 单选题: BBAAA BAABA
从奥鹏一个答案提取页面 看jquery知识点的更多相关文章
- [转载]再谈百度:KPI、无人机,以及一个必须给父母看的案例
[转载]再谈百度:KPI.无人机,以及一个必须给父母看的案例 发表于 2016-03-15 | 0 Comments | 阅读次数 33 原文: 再谈百度:KPI.无人机,以及一个必须 ...
- 开发日志系列:一个表单页面的呈现与提交(一)——JSON的操作
JSON操作 引子 最近在做一个表单页面,大概是这个样子的 这里打算用一个JSON存储所有的信息,我们可以理解为,所有东西都存在一个字符串里面.方便,快捷,易读,数据库操作也方便了.甚至,可以将很多不 ...
- 经验分享:PDF怎么提取页面
PDF文件的页面有很多但有需要的并不是全部,有时候需要其中一页或几页的时候,这个时候我们就需要把单独的页面提取出来,这个时候应该怎么做呢,上次有小伙伴来询问小编,今天小编就为大家分享一下小编自己的编辑 ...
- css笔记:如何让一个div居于页面正中间
如何让一个div居于页面中间,我今天说的是让一个div水平居中同时垂直居中,而不是简单的top:50%,left:50%.当然,我们就按一开始的思路写一下:top,left属性都设为50%,看一下效果 ...
- __x__(14)0906第三天__<iframe> 内联框架 引入有一个外部html页面
在现实开发中,不推荐使用内联框架,因为<iframe></iframe>中的内容不会被搜索引擎检索. 在特殊情况中,如内网项目,不用放在互联网上时,可以使用<iframe ...
- 实用的php清除html,php去除空格与换行,php清除空白行和换行,提取页面纯文本
实用的php清除html,换行,空格类,php去除空格与换行,php清除空白行和换行,提取页面纯文本内容 方法一: function DeleteHtml($str) { $str = trim($s ...
- 如何让一个div居于页面正中间
如何让一个div居于页面正中间 如何让一个div居于页面中间,我今天说的是让一个div水平居中同时垂直居中,而不是简单的top:50%,left:50%.当然,我们就按一开始的思路写一下:top,le ...
- 使用Chrome console提取页面数据
使用Chrome console提取页面数据 1.需求介绍 在做课题研究的过程中,遇到这样一个问题,有一个页面中包含很多IP地址,需要把这些IP地址提取出来保存到文件中.如下图所示: 一开始的做法是一 ...
- AOS – 另外一个独特的页面滚动动画库(CSS3)
AOS 是一个用于在页面滚动的时候呈现元素动画的工具库,你可能会觉得它和 WOWJS 一样,的确他们效果是类似的.但是AOS是 CSS3 动画驱动的库,当你滚动页面的时候能让元素动起来,当页面滚回顶部 ...
随机推荐
- C++的函数重载 转
——每个现象后面都隐藏一个本质,关键在于我们是否去挖掘 写在前面: 函数重载的重要性不言而明,但是你知道C++中函数重载是如何实现的呢(虽然本文谈的是C++中函数重载的实现,但我想其它语言也是类似的) ...
- 如何给html元素的onclick事件传递参数(即如何获取html标签的data-*属性)
现在做的一个小系统为了达到领导所说的很炫的效果有用到Metro UI CSS,但是因为如何给每个磁贴(div标签)的click事件传递参数折腾了蛮久(偶是菜鸟),后来终于找到一个解决方案即通过data ...
- php session 自定义的设置测试
<?php // ini_set('session.save_handler', 'user'); // 注意 set_session_save_handler() 一定要在 session_s ...
- javascript 自定义鼠标右键菜单
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- excel快递单号查询工具以及源码
Function kdcx(kd, orderid) Dim Err, url, kdtime, link, Errcode, Status Select Case kd '此处支持的快递公司很多的 ...
- JS禁止横竖屏切换,强制横竖屏显示
js判断屏幕横竖屏: function orient() { //alert('gete'); if (window.orientation == 0 || window.orientation == ...
- 玩转C++运算符重载
运算符重载语法:返回值类型 operator运算符(参数列表) { 代码逻辑... } C++中的运算符重载是通过函数来实现的,可以将重载的运算符看作是类成的一个成员函数,向普通函数一样调用.如重 ...
- Servlet处理Cookie
1.CGI:进程,servlet:线程 2.HttpServletResponse下的方法就没有get开头的,(PrintWriter)getWriter在ServletResponse下. 3.st ...
- 关于 width;height
IE Firefox Chrome Safari window(width|height) no yes yes document.body document.documentElement 网页 ...
- Swift入门系列--Swift官方文档(2.2)--中文翻译--About Swift 关于Swift
About Swift 关于Swift 官方文档的翻译,仅供参考,本人英语本就不好,边学边翻译,不喜勿喷. Swift is a new programming language for iOS, O ...