How to disable a link that is calling a modal bootstrap?

Asked

Viewed 141 times

0

I’m trying to make a <a href> not call a modal of the Bootstrap.

<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" disabled="disabled" tabindex="-1" class="disabled-link">Aceito os termos</a> </label>

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

This code calls a modal, how to disable it so that it does not call modal when loading from the page?

  • Looks like you got a data-toggle="modal" on your link a, try removing it and see if it works

  • but I need to call this modal later, I just need to disable it

  • You can’t just remove the data-target per hour and then put back?

  • How to do this in Jquery?

  • Is a code that you don’t have access to? You ta wanting some kind of hack so the link doesn’t work by time then?

  • an, did not understand what you say? no, I need to disable it himself

  • Try the following, with the link class name you enter the following jQuery code $('.disabled-link').unbind(); This code will take the link click function.

  • Basically the following. The link has to be disabled by native, when the user selects an option, ai yes enables

  • Solved, I changed from $("#dtTarget"). attr('target', '#thermosContract'); to $("#dtTarget"). attr('data-target', '#thermosContract');

Show 5 more comments

1 answer

0

What happens is that the anchor element - <a /> - does not have the attribute disabled, but the element <button /> has this attribute.

So you just switch the element:

<a data-toggle="modal" data-target="#termosContrato" disabled="disabled" tabindex="-1" class="disabled-link">Aceito os termos</a>

For:

 <button data-toggle="modal" data-target="#termosContrato" disabled="disabled" tabindex="-1" class="disabled-link">Aceito os termos</button>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.