toggle wrapInner with jquery -
i can't seem find toggle method jquery's wrap.
simply want toggle wrap of span when .toggle_comments clicked.
$( document ).on('click', '.toggle_comments', function( event ){ $( ).closest( "p" ).wrapinner( $( "<span class='inline-comments-highlight-text'></span>" ) ); });
you don't find because such method doesn't exist. like:
var spanhtml = "<span class='inline-comments-highlight-text'></span>", spansel = "span.inline-comments-highlight-text" ; $( document ).on('click', '.toggle_comments', function( event ) { var $p = $(this).closest("p"), $span = $p.children(spansel); if ( $span.length ) { $span.children().unwrap(); } else { $p.wrapinner(spanhtml); } });
Comments
Post a Comment