Reputation: 1055
I've got a problem.
I have this window confirm:
<td>
<span>
<a onClick="return confirm('Opravdu si přejete odebrat školu z oblíbených?');" href="{{ path('parent/school/remove', {'school_id': school.id}) }}">
<i class="fa fa-times-circle fa-2x"></i>
</a>
{{school.name}}
</span>
</td>
But whether i click on Ok, or on Cancel, it will still proc the link in the href attribute and redirect to this action.
Upvotes: 0
Views: 393
Reputation: 94339
Do it like this:
<a onclick="confirm('Leave?') || event.preventDefault()" href="http://en.wikipedia.org">Wikipedia</a>
http://jsfiddle.net/DerekL/5s47wujv/
Upvotes: 3