jQuery HTML Element - 如何從內(nèi)部錨點(diǎn)的內(nèi)部div標(biāo)記中刪除href
我們想知道如何從內(nèi)部錨點(diǎn)的內(nèi)部div標(biāo)記中刪除href。
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.7.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){
$('a').click(function(e){
console.log(e.target);
if($(e.target).hasClass('tooltip')){
return false;
}
});
});
</script>
</head>
<body>
<a >Title
<div class="tooltip">My text....</div>
</a>
</body>
</html>
The code above is rendered as follows: