How to remove line when checked in tinymce?

Question

I have added some content to a tinymce editor , some lines that each have a checkbox like this enter image description here

What I need is that when I click a checkbox , that line to be removed

I have placed an alert on the onclick input event for tinymce (just to test if the event is triggered) , but it is not working.
Here is my entire code from functions.php:

function wpb_hook_javascript() {
    ?>
        <script>
        
jQuery(document).ready(function() { 
        
        jQuery("#tinymce").delegate("input", "click", function() {
            alert('a'); // not working 
        }); 
                        
                        var text='';                        
                        text+='<ul class="extra-details">';
                        var i;
                        
                        
                        for (i = 0; i < properties.length; i++) {
                    
                                text+='<li><input type="checkbox" id="properties"'+i+' name="properties[]"><div class="item-attr" style="display: inline-block;">'+properties[i].address.line+', '+properties[i].address.city+', '+properties[i].address.state_code+', '+properties[i].address.postal_code+'  &nbsp;</div><div class="item-property" style="display: inline-block;"> <p>$'+properties[i].price+'</p></div><div class="item-property-more" style="display: inline-block;float: right;margin-right: 10px;"><p>'+properties[i].baths+'</p></div><div class="item-property-more" style="display: inline-block;float: right;margin-right: 10px;"><p>'+properties[i].beds+'</p></div><div class="item-property-more" style="display: inline-block;float: right;margin-right: 10px;"><p>'+lot_size+'</p></div></li>';                          
                            }
                                text+='</ul>';
            
            tinymce.editors[0].setContent(text); 
            console.log(text);

});
        </script>
    <?php
}
add_action('admin_footer', 'wpb_hook_javascript');
add_action('wp_footer', 'wpb_hook_javascript');
0
Andreea Onica 1 year 2020-07-16T04:10:29-05:00 0 Answers 59 views 0

Leave an answer

Browse
Browse