want to build a function inside a href link. should look like this
<a href="javacript:destroy();"></a>
How do i complete it correct?
Use onclick
to trigger a function instead of href
HTML
<a href="#" onclick="destroy()"></a>
JS
function destroy()
{ //rest of the code
return false; // return false is use to prevent default behavior
}
Note: If you dont use return false
or event.preventDefault
it will execute the default behavior