2

I want to implement a simple javascript in my post.

How to add that in wordpress.

I have an image in the post and when the user clicks on the image i want to display a dropdown. I want it to be in the post. I get the image in the output and the rest of the code that means the onclick event is written as it is in the html format.

I have the code in simple html and javascript. The code is http://pastebin.com/KqQrMPsu.

Plz can someone help.

Thanks,

1 Answer 1

2

If you want that to be in just one single post, you can use the "html" editor, instead of the "Visual" editor. Select the "HTML" tab, and enter

<script type="text/javascript">
// For: http://www.codingforums.com/showthread.php?t=211072

function changeImg(info) {
  if (info == '') { return; }
  document.getElementById('mainImage').src = info;
  document.getElementById('SBox').style.display = 'none';
}
</script>

Be sure to put it in your HTML tab instead of your Visual editor.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.