Rajan
Rajan

Reputation: 2425

How to open a bootstrap modal on click of Glyphicons?

I my view I am showing a edit button using Glyphicons.

Now On the click of that icon I want to open a modal. How what should I do ?

Here is what I am doing :

<h3>  <?php echo $this->session->userdata('site');?>&nbsp<i class="fa fa-pencil-square-o"></i></h3>

I tried this way:

<h3>  <?php echo $this->session->userdata('site');?>&nbsp<i class="fa fa-pencil-square-o" data-target="#activateddevices"></i></h3>

But this does not work.

My Modal:

<div class="modal fade" id="activateddevices" role="dialog">
<div class="modal-dialog">

  <!-- Modal content-->
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h4 class="modal-title">Devices Activated Using : <?php echo $this->session->userdata('site');?></h4>

      <h4 class="modal-title">Activated: <?php echo $used."/".$allowed;?></h4>


    </div>
    <div class="modal-body">


     //CONTENT

    </div>

  </div>

</div>

Upvotes: 1

Views: 2239

Answers (1)

Maths RkBala
Maths RkBala

Reputation: 2195

Try the following:

 <h3>  <?php echo $this->session->userdata('site');?>&nbsp<i class="fa fa-pencil-square-o" data-toggle="modal" data-target="#activateddevices"></i></h3>

Upvotes: 2

Related Questions