클릭하면이 글리프 콘을 변경하려고하는데 href = "#"하지만 원래 href에 django의 데이터베이스를 조회하는 URL이 포함되어 있으면 잘 작동합니다.글리프콘을 클릭 할 때 변경하십시오.
HTML :
<div class='hidden-lg'>
<div class="content-header">
<h1>
<a id = "star" href="#" data-toggle="tooltip" title = "Add to your list" data-placement="top">
<span class="glyphicon glyphicon-star-empty"></span>
</a>
</h1>
</div>
</div>
JS는 :
$('#star').click(function(){
$(this).find('span').toggleClass('glyphicon glyphicon-star-empty').toggleClass('glyphicon glyphicon-star');
});
이 잘 작동합니다. http://jsfiddle.net/asees/5XqyW/564/
하지만 href를 아래 코드로 변경하면 글리프콘이 변경되지 않습니다.
<a id = "star" href="{% url 'add' %}" data-toggle="tooltip" title = "Add to your list" data-placement="top">
<span class="glyphicon glyphicon-star-empty"></span>
</a>
내가 해달라고합니다. –
@ DanielA.White가 바이올린을 편집했습니다. – avleen01