I have tried numerous javascript/jquery codes to get my form (after 'submit' is clicked) to reset the screen zoom/viewport. My page does NOT reload on 'submit' but merely loads the 'submit successful' message. Nothing I've tried so far has worked. I am using the below code
jQuery(document).ready(function($){
$('#form-id').submit(function(event) {
var viewportmeta = document.querySelector('meta[name="viewport"]');
if (viewportmeta) {
viewportmeta.setAttribute('content', 'width=device-width, maximum-scale=1.0, initial-scale=1.0');
}
});
});
I have tried different variations of this but I'm no expert. Do I need to put 'form' before the form id?
$('form#form-id')
Am I messing up the syntax between javascript and jQuery? Typos? Any help would be greatly appreciated :)