如何使用$(this).Children()在包含多个空格的jQuery中追加li [英] how to append li in ul usiing jquery using $(this).Children() which contain multiple spaces

查看:186
本文介绍了如何使用$(this).Children()在包含多个空格的jQuery中追加li的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想使用jquery附加

  • in
      .我用以下行成功完成了它:

        var  ChosedItem = $(" );
      ChosedItem.append(' < li id ="+ $(this).attr(" limit ="+ $( this).attr(>< span>' + $( 0 )+ ' </span></li>'); ) pre> 
      在此#chosedItem中是
        存在的div id

        但是在我的情况下,问题是如果我的
      • 项目包含空格.那么由于我使用的是chlidren(0),所以它没有在孩子的第[0]个位置之后添加.我用什么代替children(0)来添加
        • 包含多个空格的项目.

          问候
          Jeet Nim

解决方案

(" ); ChosedItem.append(' < li id ="+


(this) .attr("limit =" +


(this).attr(>< span>' +


Hello,

I want to append

  • in
      using jquery.I Done it successfully with following line:

      var ChosedItem = $("#chosedItem");
      ChosedItem.append('<li id=" + $(this).attr(" limit=" + $(this).attr("><span>' + $(this).children(0) + '</span></li>');


      in this #chosedItem is div id where the

        exist

        But the Problem in my case is if my
      • items contain spaces.then it not added after[0]th position of children because i am using chlidren(0).what i use in place of children(0) to add
        • items that contain multiple spaces.

          Regards
          Jeet Nim

解决方案

("#chosedItem"); ChosedItem.append('<li id=" +


(this).attr(" limit=" +


(this).attr("><span>' +


这篇关于如何使用$(this).Children()在包含多个空格的jQuery中追加li的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆