Disable bootstrap modal

0

I'm trying to disable a bootstrap modal.

I need it to start by default on the disabled page, not calling the modal bootstrap, then be activated when selecting an option.

Well, I've tried some alternatives that did not work out.

First I tried to do with the function unbind();

$('.disabled-link').unbind();

The idea was to try to take the function of the click of the link, it did not work, as the modal continues to appear.

Another alternative I thought was to take the data-target="termsContract" and then replace it with attr

$("#dtTarget").attr('target', '#termosContrato');

Follow my div code that calls modal

<div class="row">
  <div class="col-md-6">
    <div class="form-group">
      <div class="md-checkbox-list has-feedback" id="divTermosContrato">
        <div class="md-checkbox">
          <input type="checkbox" id="chkTermosContrato" name="chkTermosContrato" value="1" class="md-check" disabled="disabled">
          <label for="chkTermosContrato">
             <span></span>
             <span class="check"></span>
             <span class="box"></span> <a data-toggle="modal" data-target="#termosContrato" id="dtTarget" class="disabled-link">Aceito os termos</a> </label>

        </div>
      </div>
      <span class="erroTermos help-block"> </span>
    </div>
  </div>
  </div

Thanks in advance for the help.

    
asked by anonymous 08.08.2017 / 14:09

2 answers

0

To manipulate attributes with the data prefix using jQuery it is recommended to use the data example function:

Paste data-target :

let target = $( '#dtTarget' ).data( 'target' );

Change data-target :

$( '#dtTarget' ).data( 'target', '#termosContrato' );
    
08.08.2017 / 19:51
0

The solution was to change from:

$("#dtTarget").attr('target', '#termosContrato');

To:

$("#dtTarget").attr('data-target', '#termosContrato');
    
08.08.2017 / 14:33