2 * HTMLForm enhancements:
3 * Add/remove cloner clones without having to resubmit the form.
9 mw
.hook( 'htmlform.enhance' ).add( function ( $root
) {
10 $root
.find( '.mw-htmlform-cloner-delete-button' ).filter( ':input' ).click( function ( ev
) {
12 $( this ).closest( 'li.mw-htmlform-cloner-li' ).remove();
15 $root
.find( '.mw-htmlform-cloner-create-button' ).filter( ':input' ).click( function ( ev
) {
20 $ul
= $( this ).prev( 'ul.mw-htmlform-cloner-ul' );
22 html
= $ul
.data( 'template' ).replace(
23 new RegExp( mw
.RegExp
.escape( $ul
.data( 'uniqueId' ) ), 'g' ),
24 'clone' + ( ++cloneCounter
)
28 .addClass( 'mw-htmlform-cloner-li' )
32 mw
.hook( 'htmlform.enhance' ).fire( $li
);
36 }( mediaWiki
, jQuery
) );