Weird thing --onclick event disappears when I switch the visual and text tab

痞子三分冷 提交于 2019-12-11 10:25:43

问题


here is the piece of code I want to add the wordpress page:

But when I click visual tab and come back to text tab. The onclick event disappeared:

Can anyone explain why it happens? why do it change the code when I switch the visual and text tab! Thanks in advance!


回答1:


Check this question:

Wordpress insert javascript into page text area

Basically, check that you are not inside a p or anther element or have a look to the plugin they suggest on that answer:

http://wordpress.org/extend/plugins/raw-html/




回答2:


Wordpress strips code from your posts which is why that is happening.

Source: http://wordpress.org/support/topic/placing-javascript-in-posts



来源:https://stackoverflow.com/questions/24828563/weird-thing-onclick-event-disappears-when-i-switch-the-visual-and-text-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!