Welcome Guest, Not a member yet? Register   Sign In
Boostrap Modal doesn't work
#1

Hello I hope you can help me with the problem I'm having right now.

I'm trying to execute a code in JS using modals when pressing a button, the thing is, the HTML code who has the button generates itself 

Part of the Main View page


Code:
    <tr class="odd">
    <td class=" sorting_1">CU</td>
    <td class="">Cliente Unico</td><td class="">101</td>
    <td class="">
    <span id="edit_CU" class="ui-icon ui-icon-pencil" data-toggle="modal" data-target="#modal_edit"></span>
    <span id="delete_CU" class="ui-icon ui-icon-trash" data-toggle="modal" data-target="#modal_delete"></span>
    </td>
    </tr>

In the id="edit_CU" the CU changes when the HTML code is generated, so is not always the same thats also with the id="delete_CU"

When you click in the span icon will trigger the modal and show this:

View page when you click Edit or Delete button will show a window with this message


Code:
    <div id="modal_delete" class="modal fade">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Delete vertical</h4>
                </div>
                <div class="modal-body">
                    <p>Are you sure you want to delete?</p>                 
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
                    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_delete">Yes</button>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="<?php echo base_url('assets/js/helper/func_verticales.js');?>"></script>


In this view page ask the user if they want to delete their information when they click "Yes" it should pop up a message... but it does nothing, someone can give me a hand?

This is the JavaScript


Code:
     $("#modal_delete").on('show.bs.modal', function(event){
      alert("hello");
      });
    });
Reply
#2

For one you need to use an anchor tag for href not a span tag.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Here is a jQuery and Bootstrap plugin for all types of Modals:

Bootbox JS
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

It work now, Thank you!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB