将标签附加到另一个标签内的内部标签 [英] Appending a tag to the inner tag which is within another tag

查看:87
本文介绍了将标签附加到另一个标签内的内部标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个div标签,必须将其附加在已经在另一个div标签中的div标签中.有没有可能使用jquery的append函数来执行此操作.如果有人有解决方案,请回复.

谢谢和问候,
Bhavani

解决方案

 <     ="   http://www.w3.org/1999/xhtml" <  头部 > 
  <  样式 > 
       p  {背景 : 黄色; }
  </ 样式 > 
  <  脚本    ="   http://code.jquery.com/jquery-latest. js" <  / 脚本 > 
   <  /head  > 
   <  正文 > 
   
    <   div     ="   innerTwo" <   h2  > 我在里面也是div标签内的div标签<  /h2  <  /div  > 
   
   <   h2  > 问候<  /h2  > 
    <   div     ="  容器" <   div     ="   innerOne" <  > 
    <  /div  > 
        
    <  脚本 >  

(' .innerOne').append(


(' .innerTwo')); < / 脚本 > < /body > < /html >



div"innerTwo"追加到已经在另一个称为"container"的div内部的innerOne上.希望这对您有帮助...


Hi,
I have a div tag which has to be appended within a div tag which is already in another div tag. Is there any possibility to do this using append function of jquery.Reply if anyone has a solution.

Thanks and regards,
Bhavani

解决方案

<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
  <style>   
      p { background:yellow; } 
  </style>  
  <script src="http://code.jquery.com/jquery-latest.js"></script>
   </head> 
   <body>
   
    <div class="innerTwo">
            <h2>I am inside a div tag which is also inside a div tag</h2>
   </div>
   
   <h2>Greetings</h2>
    <div class="container">
        <div class="innerOne">Hello</div>
    </div>
        
    <script>


('.innerOne').append(


('.innerTwo')); </script> </body> </html>



The div "innerTwo" is appended to innerOne which is already inside another div called "container".. Hope this helps you...


这篇关于将标签附加到另一个标签内的内部标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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