var cj="<a class='div_c'></a>";
   $(".div_btn").each(function(){
    $(this).click(function(){
    //var a = $(this).createElement('a');
    //a.setAttribute("class","div_c");
    $(this).closest('div').append(cj);
    $(this).remove();
    })
  
  
    })

解决方案 »

  1.   

    请问下 当我点击".div_btn"的时候 创建了".div_c"  点击创建".div_c" 还原".div_btn" 
    还有就是在点击其他的".div_btn"的时候 已经创建了的".div_c" 也要还原回去请问下 应该怎么做啊
      

  2.   

    $(".div_btn").live("click",function(){ //必须用live或者on 视jq版本而定
                $(this).parents(".div").html('<a class="iv_c"></a>').siblings(".div").html('<a href="javascript:void(0)" class="div_btn">点击</a>');
            })