[wp-trac] [WordPress Trac] #28702: using jQuery.on binding for catching the click in custom-header.js

WordPress Trac noreply at wordpress.org
Tue Jul 1 07:47:17 UTC 2014


#28702: using jQuery.on binding for catching the click in custom-header.js
----------------------------+-----------------------------
 Reporter:  DaanMeijer      |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 I ran into this while building a theme that allows for images in it's
 custom widgets. The problem:

 I want to use wp-admin/js/custom-header.js to bind to my
 {{{ <a id="choose-from-library-link"> ... </a> }}},
 but because a widget form is loaded through AJAX, the element does not
 exist in the DOM yet, when the click is caught.

 I propose changing line 18 of wp-admin/js/custom-header.js to
 {{{ $(document).on('click', '#choose-from-library-link', function( event )
 { }}}.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28702>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list