Opened 16 years ago
Closed 16 years ago
#9881 closed defect (bug) (invalid)
Can't toggle the visibilty using jQuery anymore
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.8 |
Component: | JavaScript | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
I was testing my plugin 'One Word A Day' in WP 2.8 and I cannot toggle the visibility of a div block anymore.
This is the jQuery code ( Line 96: http://svn.wp-plugins.org/one-word-a-day/trunk/classes/class.widget.php ) :
jQuery("#owad_post_settings").toggle("slow");
and this is the div block:
echo '<div id="owad_post_settings" style="';
if( ! $optionsowad_daily_post? )
echo 'display:none;';
echo '">';
some code with ending div tag
I even couldn't save the plugin options. I saw that there is a multiple widget support for plugins so can't I use my old code anymore? What goes wrong?
Attachments (2)
Change History (16)
#2
follow-up:
↓ 4
@
16 years ago
Think there's an error in your selector, jQuery("input[name=owad_daily_post]")
should be jQuery("input[name=\'owad_daily_post\']")
. Some of this changed in jQuery 1.3.
#3
follow-up:
↓ 5
@
16 years ago
@andrew: the other issue is very real, though. If old-style widgets are supposed to work with the new API, the fact of the matter is they do not.
The attached plugin to convince you.
#4
in reply to:
↑ 2
@
16 years ago
Replying to azaozz:
Think there's an error in your selector,
jQuery("input[name=owad_daily_post]")
should bejQuery("input[name=\'owad_daily_post\']")
. Some of this changed in jQuery 1.3.
The selector works. If I put "alert();" in the function body the alert window appears. But it appears twice! Using show() instead of toggle() doesn't change anything. I'll check the jQuery 1.3 API for that.
jQuery("input[name=owad_daily_post]").change(function () {
jQuery("#owad_post_settings").toggle("slow");
alert('This message appears so the selector is fine - arg karg');
});
});
The other problem is solved. The submit name changed from save-widgets to savewidget.
#5
in reply to:
↑ 3
@
16 years ago
Replying to Denis-de-Bernardy:
The attached plugin to convince you.
It seems that the $control_callback
in wp_register_widget_control($id, $name, $control_callback, $options = array())
is not set properly in the attached plugin.
is_callable( $control_callback )
returns false.
#6
@
16 years ago
it would return false when is_admin() returns false, yes, since the class is only around on the widgets.php page. but that shoudn't be an issue, should it?
#7
@
16 years ago
Or then, maybe toss in a do_action("load-widgets.php"); call in admin-ajax.php where needed for backwards compat. I can't possibly be the only one who doesn't stick to loading admin functions when needed.
#8
@
16 years ago
@ azaozz: This was the first time using trac. Why are you the owner?
@ Whoever is able to: Can anyone split the posts related to Denis-de-Bernardy problem up? My problem is caused by jQuery.
I took a look in the jQuery 1.3 API and toggle() should be valid as I used it.
-> jQuery("#owad_post_settings").toggle("slow");
I've attached my plugin to this thread.
#9
@
16 years ago
The plugin throws errors on activation (php4). Tested this with other widgets and all seems to work properly.
#11
follow-up:
↓ 13
@
16 years ago
- Keywords reporter-feedback removed
- Owner changed from azaozz to mcosx
- Status changed from new to assigned
Please tell me what errors are thrown. PHP5 is available since four or five years :-/
#13
in reply to:
↑ 11
@
16 years ago
Replying to mcosx:
Please tell me what errors are thrown. PHP5 is available since four or five years :-/
The classes aren't initialized properly. WordPress supports php >= 4.3. If you don't want to support it in your plugin, perhaps do a version check at the beginning and show a warning, etc.
Sounds like you're like me... in for a rewrite of all of your plugins that insert widgets. ;-)