WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#10508 closed defect (bug) (invalid)

Javascript show/hide not working in WP 2.8 widget section

Reported by: namus25 Owned by: azaozz
Milestone: Priority: high
Severity: blocker Version:
Component: JavaScript Keywords:
Focuses: 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)

widget2.8.zip (793 bytes) - added by namus25 9 years ago.

Download all attachments as: .zip

Change History (3)

@namus25
9 years ago

#1 @azaozz
9 years ago

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

#2 @azaozz
9 years ago

  • Milestone Unassigned deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 2.8.1 deleted

No feedback in two weeks and probably the plugin's js needed update.

Note: See TracTickets for help on using tickets.