Weird thing --onclick event disappears when I swit

2019-08-08 17:39发布

here is the piece of code I want to add the wordpress page: enter image description here But when I click visual tab and come back to text tab. The onclick event disappeared: enter image description here enter image description here

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

2条回答
干净又极端
2楼-- · 2019-08-08 17:58

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/

查看更多
Emotional °昔
3楼-- · 2019-08-08 18:00

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

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

查看更多
登录 后发表回答