Mahesh Patil

Mahesh Patil

  • NA
  • 41
  • 10.5k

Anchor Tag enable using Jquery

May 20 2015 11:15 AM
Hello all,
 
My code for disable anchor tag is like
 
function disablediv() {
$('#div1 :button').attr('disabled', true);
$("a").click(function (event) {
event.preventDefault();
});
}
 
<div id="div1">
<input type="button" id="btn1" value="alert" onclick="alertdiv()" />
<ul>
<li><a href ="#" id ="a1">gmail</a></li>
</ul>
</div>
 
 
<input type="button" id="show" value="Disable" onclick="disablediv()" /> 
 
using this code i have disabled the all anchor tag but after that i cant enable the anchor tag. 
 
Plaese any one tell me how to enable all anchor tag after  event.preventDefault(); 
 
Thanks 

Answers (2)