相关疑难解决方法(0)

Javascript替换没有任何影响

这是jQuery:

<script type="text/javascript">
    $(document).ready(function(){
        var relName;
        $('.child').each(function() {
            relName = $(this).attr('rel');
            relName.replace('&','');
            $(this).attr('rel', relName);
            $(this).appendTo('#' + $(this).attr('rel'));
        });
    }); 
</script>
Run Code Online (Sandbox Code Playgroud)

使用这个相关的HTML:

<div rel="MadDogs&EnglishmenHandpaintedfigurines" id="Figurines" class="category section child">
     <h3 class="categoryTitle">Figurines</h3>               
</div>
Run Code Online (Sandbox Code Playgroud)

但由于某种原因,替换没有任何影响!

javascript jquery

1
推荐指数
1
解决办法
170
查看次数

标签 统计

javascript ×1

jquery ×1