Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何(移动)或添加jpg';图像';使用jquery从一个div到另一个div?_Jquery_Image - Fatal编程技术网

如何(移动)或添加jpg';图像';使用jquery从一个div到另一个div?

如何(移动)或添加jpg';图像';使用jquery从一个div到另一个div?,jquery,image,Jquery,Image,大家好,我现在正在处理jquery,我的html是这样的 <div class="grid row-fluid"> <div> <span class="span1"> <input type="checkbox" class="regular-checkbox" id="Header" /> <

大家好,我现在正在处理jquery,我的html是这样的

            <div class="grid row-fluid">
          <div>
            <span class="span1">                
            <input type="checkbox" class="regular-checkbox" id="Header" />
            <label for="Header"></label>                
            </span> 
            <span class="span1"> <img class="img-polaroid" src="http://placehold.it/140x140"></span> 
           </div>


             <div>
            <span class="span1">                
            <input type="checkbox" class="regular-checkbox" id="Header" />
            <label for="Header"></label>                
            </span> 
            <span class="span1"> <img class="img-polaroid" src="http://placehold.it/140x140"></span> 
           </div>
           </div>


           <div class="span7" style="border:1px black" id="separate">

                <ul class="thumbnails bootstrap-examples pre-scrollable">
                    <li class="span2">
                      <a href="#">
                        //image shold add here
                      </a>
                      </li>
                     </ul>
         </div>

如何使用jquery将图像从一个div添加到另一个div请您帮助我做到这一点,提前感谢这是您可以做到的:

$(function(){
  $('input[type="checkbox"]').click(function(){
    AddToCart(this);
  });
});

function AddToCart(obj) {
  var $this = $(obj).closest('div');
  var img = $this.find('img');
  $('#div2').append(img);
}

从一个div中获取图像,然后使用jQuery append()或appendTo()将其添加到另一个div中我试过它说append()或appendTo()不支持我更新了我的问题,它说AddToCart(obj)是未定义的首先感谢我的回复pulkit它正在工作,但是我需要通过单击按钮附加一些复选框的更改,你能帮我这样做吗替换$('#div2')。附加(img);使用$('#separate')。追加(img);谢谢pulkit Mittal先生非常感谢您的回复很好,不客气,Shakil。对不起,我不在电脑旁,因此无法回答您的进一步询问。请原谅。
$(function(){
  $('input[type="checkbox"]').click(function(){
    AddToCart(this);
  });
});

function AddToCart(obj) {
  var $this = $(obj).closest('div');
  var img = $this.find('img');
  $('#div2').append(img);
}