I'm attempting to change a webpage within the Wordpress menu dynamically. That's, I shouldn't alter the menu itself, however the page that's displayed within the after sales. I'm using jquery to include a div when a button is clicked on. My javascript function appears like this

$(document).ready(function(){
    $("#show").click(function(){
        $(".some_div").after("<div>I am added</div>").attr('class', 'some_class');      
    });
});

The button that's clicked on submits an application and appears such as this

<input type="submit" name="show" id="show" value="Show Me" class="button-primary" />

When the button is clicked on, the script works fine with the addition of the div briefly. The issue is, the page is reloaded too and also the web coding is "totally reset" to ensure that the additional div vanishes again. Does anybody know a workaround with this?

You are able to avoid the default behavior from the form button by utilizing preventDefault(), works such as this:

$(document).ready(function(){
    $("#myForm").submit(function(e){
        e.preventDefault();
        $(".some_div").after("<div>I am added</div>").attr('class', 'some_class');      
    });
});

See: http://api.jquery.com/submit/

Try

$(document).ready(function(){
    $("#show").click(function(e){
        e.preventDefault();
        $(".some_div").after("<div>I am added</div>").attr('class', 'some_class');      
    });
});