I have a button inside a <form> that always submits the entire form, even though it's not a submit button.
HTML:
<button id="button-app-preview" class="k-button">Oppdater</button>
JS:
$("#button-app-preview").click(preview);
function preview() {
$("#app-preview").html(template({
overskrift: $("#input-overskrift").val(),
ingress: $("#input-ingress").val(),
brodtekst: $("#input-brodtekst").val(),
bildeurl: $("#bilde-sti").val()
}));
}
Any ideas how come this button when clicked, first performs the preview() function, but then after it submits the entire form?
HTML:
<button id="button-app-preview" class="k-button">Oppdater</button>
JS:
$("#button-app-preview").click(preview);
function preview() {
$("#app-preview").html(template({
overskrift: $("#input-overskrift").val(),
ingress: $("#input-ingress").val(),
brodtekst: $("#input-brodtekst").val(),
bildeurl: $("#bilde-sti").val()
}));
}
Any ideas how come this button when clicked, first performs the preview() function, but then after it submits the entire form?