Skip to content

Commit

Permalink
Update legacy-widget-block.md (#44343)
Browse files Browse the repository at this point in the history
`$control` is not the first argument passed to the event. Anyone who tries to use this code will encounter an error stating `$control.find is not a function`.

This blog post will also need updating: https://make.wordpress.org/core/2021/06/29/block-based-widgets-editor-in-wordpress-5-8/
  • Loading branch information
cameronjonesweb authored Jan 9, 2023
1 parent 980100c commit e28e4f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/how-to-guides/widgets/legacy-widget-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For example, a widget might want to show a "Password" field when the "Change pas

```js
( function ( $ ) {
$( document ).on( 'widget-added', function ( $control ) {
$( document ).on( 'widget-added', function ( $event, $control ) {
$control.find( '.change-password' ).on( 'change', function () {
var isChecked = $( this ).prop( 'checked' );
$control.find( '.password' ).toggleClass( 'hidden', ! isChecked );
Expand Down

0 comments on commit e28e4f2

Please sign in to comment.