如何修复冻结加载GIF提交点击移动,并修复加载后点击显示的GIF

I have created a web page that has a form that prompts the user for two text-inputs and 1 radio-input. Once the user clicks submit, I have a function that is run OnClick that will use jQuery to hide() the form and show() the loading GIF.

<input type="submit" value="Submit" id="submitinput" onClick="loading();">

function

<script>

function loading(){
    $("#form1").hide();
    $("#loadingGIF").show();
}

</script>

On a desktop/laptop computer everything works fine (using Chrome for both), but on a tablet or phone (tested in Safari and Chrome) things go wrong. In the CSS stylesheet, I have the loading GIF set to display:none. I have tried to use the $(document).ready() function. I had the thought to have another function to maybe auto-refresh, but I'm not confident how to do that yet.