Weird thing --onclick event disappears when I swit

2019-08-08 17:33发布

问题:

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