Opened 4 years ago
Closed 4 years ago
#10508 closed defect (bug) (invalid)
Javascript show/hide not working in WP 2.8 widget section
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | JavaScript | Version: | |
| Severity: | blocker | Keywords: | |
| Cc: |
Description
I'm using a simple javascript to show/hide some content in the widget section of wordpress 2.8.2. But the show hide functionality doesn't work at all. Below is the code I used in widget:
<a href='toggleME()'>Toggle</a>
<div id='div1' style='display:none'>Show/Hide Me</div>
<script>
function toggleME(){
var div1 = document.getElementById('div1');
if (div1.style.display == 'none') {
div1.style.display = 'block';
} else {
div1.style.display = 'none';
}
}
</script>
You can also download a sample plugin here to test with:
<a href="http://www.maxblogpress.com/temp/widget2.8.zip">http://www.maxblogpress.com/temp/widget2.8.zip</a>
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.

<a href='toggleME()'>? How about <a href='' onclick='function(){toggleME();return false;}'>? Or even better jQuery('#toggleME').toggle().