Printing a JS variable in a value=“” attribute

前端 未结 3 858
自闭症患者
自闭症患者 2021-01-27 11:45

I\'m trying to implement a Paypal button with a dynamic value. When I enter, for example, value=\"300.00\", the button works fine.

However, if I do it my way, the button

3条回答
  •  轮回少年
    2021-01-27 12:16

    In javascript:

    document.write('')
    

    Or better yet

    var div = document.createElement('div');
    div.innerHTML = '';
    document.body.appendChild(div);
    

    DEMO

提交回复
热议问题