KhAn SaAb
KhAn SaAb

Reputation: 5366

I want to disabled onClick event for image inside div onClick function?

I want to disable click event for image using image id eg. for id12 i want to disabled click event . i tried using unbind but it seems it only works if event is binded using j query?

Upvotes: 2

Views: 1026

Answers (6)

Sudarshan Tanwar
Sudarshan Tanwar

Reputation: 3607

Below is pure javascript code. Try this :

document.getElementById('id12').setAttribute("onclick", null);

Upvotes: -1

Ales
Ales

Reputation: 908

    $("#id12").on('click',function(e){
       e.preventDefault();
    });

Upvotes: 1

PSR
PSR

Reputation: 40318

$("#id12").on('click',function(e){
  e.preventDefault();
});

Upvotes: 7

user1
user1

Reputation: 1065

$("#id12").on('click',function(e){ e.preventDefault(); });

Upvotes: 1

Geeky Guy
Geeky Guy

Reputation: 9399

$("#id12").click(function () { return false; });

Upvotes: 1

Adil Shaikh
Adil Shaikh

Reputation: 44740

$("#id12").on('click',function(){
  return false;
});

Upvotes: 1

Related Questions