在Jquery中,我用另一个div替换div

时间:2014-03-14 07:33:19

标签: jquery jquery-ui jquery-plugins

我的第一部分

<div class ="amazon">
    <form target="OffAmazonPaymentsPopupWindowA24SYJTTYUTWN2" method="POST" action="https://payments.amazon.com/gp/widgets/widgets" id="OffAmazonPaymentsWidgets0Form" style="display: block; margin: 0; padding: 0; border-width: 0; overflow: hidden;">
     <input type="hidden" value="connect" name="action">
     <input type="hidden" value="https://jsdentallab.com/my-account/checkout/" name="referringURL">
     <input type="hidden" value="A24SYJTTYUTWN2" name="cartOwnerId"><input type="hidden" value="true" name="useAmazonAddressBook">
     <input type="hidden" value="" name="agreementType">
    </form>
 </div> 
  Have an Amazon account?
</div>
   <div id="pay_with_amazon">
      <img src="https://payments.amazon.com/gp/widgets/button?sellerId=A24SYJTTYUTWN2&amp;size=large&amp;color=orange">
   </div>
 </div>

将替换为 New Blank Div Class

我也提到了.replaceWith()

你能建议我吗

谢谢

2 个答案:

答案 0 :(得分:0)

这可以按照你的要求行事:

$('.amazon').replaceWith($('<div />'));

答案 1 :(得分:0)

您可以将div中的HTML设置为空

$(".amazon").html("");