Jquery disable Span with data-toggle

5.8k views Asked by At

Trying to disable this span

<span id='downloadTestModal1' data-toggle="modal" data-target="#modalDownloadTestdata" class="fa fa-download"  onmouseover="" style="cursor: pointer;" title="Download" data-tooltip="tooltip" ></span>

So far tried this, but id does not work for me.

    $('#downloadTestModal1').unbind("click");
    $("#downloadTestModal1").attr("disabled", true);
    $('#downloadTestModal1').toggleClass("disabled");

Are there any other methods?

2

There are 2 answers

0
dm4web On BEST ANSWER

http://jsfiddle.net/tw2L2ttw/1/

clear or set 'data-toggle' to disable or enable modal pop up

//## disable
$('#downloadTestModal1').attr('data-toggle','');

//## enable 
$('#downloadTestModal1').attr('data-toggle','modal');
2
coder On

Try with

$('#downloadTestModal1').preventDefault();

Since preventDefault() works only on elements with default event. In this case there is no default event for span element. Sorry for that. I used it earlier, but that was on click event atached to a element