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



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