- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我得到了这个html
<tr>
<td>
Main Alliase/Current Alliase:
</td>
<td><input type="text" id="maina" class="countchars" max="30"/><br />
<span class="showchars"></span>
</td>
<td><span id="handle-1" class="selector" title="The Main Alliase with which people know you OR the alliase with which u play most <br /> <b>You'r App would be also named after this only</b>" header="Main Alliase/Current Alliase">?</span></td>
<td><div id="error-1" class="errors"></div></td>
</tr>
还有这个js:
$('#maina').focus(function() {
$(this).closest("tr").find(".selector").qtip('toggle', true);
$(this).nextAll(".errors:first").html("Bla");
$(this).siblings(".showchars").show();
});
但是当我专注于 maina
时,它会执行其他两件事,但不会更改 errors
类的 html。
为什么会这样呢?我做错了什么?请帮我谢谢
最佳答案
我认为你应该这样做:
$(this).closest('tr').find(".errors:first").html("Bla");
这是因为 nextAll() 会查找同级元素(获取匹配元素集中每个元素的所有后续同级元素,可选地通过选择器进行过滤
),而 maina 的唯一同级元素是 span
关于jQuery .nextAll 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6909238/
我得到了这个html Main Alliase/Current Alliase: You'r App would be also named after this only" h
这是 post 请求中的代码块。 JSON 回复存储在“data”中 var a=data.Data.overview; var b=data.Data.extras; //summary var r
我需要在每个具有“topRow”类的 TR 的第一个子 TD 上添加一个点击事件,该事件会切换具有“subRow”类的所有下一个 TR 行,跳过 TR.topRow 下的第一个 TR。 表格示例
我希望有人能帮忙。我有一堆带有类“.my-div-1”、“.my-div-2”、“.my-div-3”等的 div。每个 div 内都有一个按钮,单击该按钮时会删除该 div 。我想要做的是更新所有正
我有一个支持键盘导航的列表。但是,还有额外的 jiggery pokery(本示例中未包含)可以显示和隐藏列表中的项目。隐藏项目后,键盘导航需要继续运行,但仅限于可见项目。 我的这个工作很好。当最后一
我试图找到一个函数来选择在整个页面上单击的元素之后匹配的所有元素。不管他们在什么容器里。nextAll 只给 sibling 。单击第二个时,我需要每个具有类族的 DIV,除了其中带有文本 First
jquery遍历:next()和nextAll()方法。实例如下: 复制代码 代码如下: <html> <head> &l
我有这个功能: $('.trackInputHours').change(function() { var changeVal=$(this).val(); $(this).close
我有一个如下所示的 HTML 表格,并希望在 display-order="-1" 之后获取所有 parent_tr ... .... //no of `td`
我有一个表,我使用 jQuery 数据函数向所有行添加了一些信息,如下所示: $(tr).data('info',info); 这工作正常,但这是棘手的部分:如果我单击一行,我将其余行克隆到另一个表,
我不知道这个问题的答案,这真的让我很恼火,我以为这很简单。我想从选定元素中获取下一个和上一个元素到一个限制(比如 2)。这是一个例子: link 1 link 2 link 3 link 4 lin
使用下面的代码... $("table#flooring tr") .find('td:eq('+checkbox+') input[type="checkbox"]') .prop('disable
这是我的问题 在 StackOverflow 上找到的相关/类似问题中找不到任何可行的解决方案。 我有一个充满ajax数据的选择,我们称其为“mainSelect”,它有一个“selectSometh
请帮助我如何隐藏位于 3 个元素之后的所有元素? $('.pagination_number').eq(3).nextAll('.pagination_number').hide() 1 2 3 4
我正在尝试在用户退出输入字段时获取下一个输入字段的 ID: $("input").blur(function(){ var theid = $(this).attr('id'); var thefie
我的 html 是: Delete
我编写了这个用于验证非空输入字段的简单脚本。 例如,当表单被发送并且 ID 为“name”的输入为空时,该元素旁边将显示一条短消息。问题是如果表单再次发送一次并且输入不再为空,这样做$(element
当 menuitem 被点击时,它的兄弟项会 float 到右边。 为此我使用了 jQuery 的 nextAll()。 我的问题是, float sibling 的顺序颠倒了,我希望它们保持初始顺序
事情是这样的:我需要在其他 HTMLElements 列表中查找一个元素,寻找下一个具有“.wanted-class”类的元素。我在同一类的元素之一中触发/捕获了一个 click 事件。我最终得到了如
HTML: - Parent Task - - Child task 1 - - Child task 2 jQuery 获取父任务的子任务 var selectedOption = $(
我是一名优秀的程序员,十分优秀!