Javascript 如何在jQuery中包装div?

Javascript 如何在jQuery中包装div?,javascript,jquery,drop-down-menu,styles,Javascript,Jquery,Drop Down Menu,Styles,我有一个选择框: 可选数字1 可选努默2 可选数字3 应该这样做。有关更多详细信息,请参见此处。hi这里是将整个元素包装到div中的解决方案之一 $(document).ready(function(){ $('h3').each(function(){ $(this).add( $(this).next() ).wrapAll('<div class="box"></div>'); })

我有一个
选择框


可选数字1
可选努默2
可选数字3

应该这样做。有关更多详细信息,请参见此处。

hi这里是将整个元素包装到div中的解决方案之一

   $(document).ready(function(){
         $('h3').each(function(){
          $(this).add( $(this).next() ).wrapAll('<div class="box"></div>');
         })
        })
$(文档).ready(函数(){
$('h3')。每个(函数(){
$(this.add($(this.next()).wrapAll(“”);
})
})

我找到了我的答案:

$('.bottom table.form tr td select.small').parent(".sb-custom").addClass("small");

请重新表述你的问题,它不清楚(至少对我来说:-)。谢谢。我发现这个问题很难理解。你能把最后一段改写得更有意义一点吗?也许可以举一个你希望发生什么的例子。不。。然后所有的选择框都会被包装起来,我只想把小类的选择框包装起来。请你在代码前后发布一些。i、 这是我得到的HTML,这是我需要的HTML。那会使你更容易得到帮助。
$('.bottom table.form tr td select.small').parent(".sb-custom").addClass("small");