Tag: 包装

jquery包装一个电子邮件地址

我在文本中有几个电子邮件地址,它们保存在变量中。 电子邮件地址是这种格式test[-@-]test.com现在我想用span元素test[-@-]test.com包装每个电子邮件地址test[-@-]test.com怎么能我这样做?

如何使用jquery包装2个动态html元素?

我有以下jquery,我已经创建了动态html结构 var data = [{“name”: “Afghanistan”, “code”: “A”},{“name”: “AndorrA”, “code”: “A”},{“name”: “Bouvet Island”, “code”: “B”},{“name”: “Cook Islands”, “code”: “C”}]; $.each(data, function(key, val) { if (!$(“#aZContent ul.” + val.code).is(“*”)) { $(“”, { “class”: val.code, “html”: “” + val.name + “” }) .appendTo(“#aZContent ol”) .before(” + val.code + ”); } else { $(“b.” + val.code).each(function() { if […]

如何在jQuery中包装具有不同类名的多个div块?

可能重复: 如何在jQuery中包装具有不同类名的DIV标签? 我在文档中重复了以下HTML块 My first div My second div My first div My second div … 如何用jQuery包装Div块以获得以下结果… My first div My second div My first div My second div …

如何将每个字母包装成标签“span”并添加相同的ID

这就是我现在所拥有的: DEMO 需要为每个字母添加与字母相同的ID …如下所示: t e s t 谢谢 HTML: Your word: ENTER JS: (function($){ jQuery(document).ready(function(){ $(“.enter”).live(‘click’, function(){ var value = jQuery(“input.text_field”).val(); jQuery(“.txt”).text(value); var words = $(‘.txt’).text().split(“”); var text = words.join(“”); $(“p”).html(“” + text + “”); }); }); })(jQuery);

jQuery:只包装第一个和第二个孩子,而不是其他孩子

在我的实际代码中: 我需要生产: 我正在玩包裹,wrapAll和孩子,但我卡住了。 提前致谢。 哇,谢谢! 还有一件事,如果在我的实际代码中,我有: 我如何生产: 谢谢。

jquery跨越第一个空间

我有三个单词我想在第一个空格之后添加内容 hello world成为hello world 和 hello world again成为hello world again 任何帮助将是欣赏 在这里编辑它 $( “#main-nav li a” ).each(function( index ) { $(this).html( $(this).text().replace(/([\S]*)\s(.*)/, “$1 $2”) ); });

jQuery在没有自动关闭标签的元素之前和之后插入内容

说我有以下内容: content 我想在它之前插入一些东西(注意未闭合的div) : $(“#content”).before(“pre-pre-contentpre-content “); 然后再说一些(注意我现在正在关闭div) : $(“#content”).after(” post-contentpost-post-content”); 我想要的输出是: pre-pre content pre-content content post-content post-post content 相反,我得到的是: pre-pre content pre-content content post-content post-post content 因为jQuery会自动“纠正”未关闭的标签。 小提琴 有没有办法使用.wrap()在元素之前和之后添加不同的内容而不自动关闭标签? 请注意,由于不相关的限制,我无法执行以下操作: $(“#content”).html(“Content before ” + $(“#content).html() + ” Content after”)

使用jQuery将所有元素包装在div中

我有一个很奇怪的标记但是,我有3个div: 在这3个div之间可能还有其他元素,但我需要做的是确保有一个div包装这3个div,所以标记最终会像这样: 这可能是使用jQuery的wrap或wrapAll函数吗?

在div中包装子元素的范围

所以我试图在div中包含一系列子元素,以便在组中操作它们; 试图将每个小组定位在不同的地方。 场景是我有一个随机生成li标签的列表,无论出现多少,我需要分别操作每一组十个。 为了解决这个问题,我使用了一份书面清单: Hello Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff2 Stuff2 Stuff2 Stuff2 Stuff2 Stuff2 Stuff2 Stuff2 Stuff2 Stuff2 Stuff3 Stuff3 Stuff3 Stuff3 Stuff3 Stuff3 Stuff3 Stuff3 Stuff3 Stuff3 现在,我已经能够使用以下方法轻松地将孩子们包裹在div中。 $(“ul li ul li:nth-child(n+11)”).wrapAll(“”); 但这当然不是我需要的。 这是我正在处理的代码。 var count = $(“ul li ul li”).length; for(var c = 11; c<=count;c+=10){ $("ul […]

使用jQuery从DIV中的列表中包装元素集

我有一个很长的名单,每个名字都包含在span标签中。 例: Yang Zajicek Daniela Athey Alanna Bumpers Audry Waldron Agnes Wininger Tarah Mandelbaum Dedra Paille Codi Morrone Shan Huntoon Silas Zerangue Thalia Saleh Britt Spurlock Miguelina Dasilva Scott Scholz Judith Badura Alfredia Kidder Jae Doty Charise Blakeslee Yen Axelson Aurora Cochran Lavina Crete Monique Pate Lady Edelstein Clark Summitt Milagros Whetstone Tracy Tokarski Wendolyn […]