Support » Plugins » page refresh after jquery

  • Resolved dansot

    (@dansot)


    EDIT: I’m an idiot, I forgot the return false; after the function. I will leave this here in shame so that someone else might be helped.

    Using the Insert JavaScript and CSS plugin I am able to insert a jquery script to respond to my form.

    the javascript is simply

    (function($) {
        $(".button").click(function() {
          $('#promocode').html("test");
        });
    })(jQuery);

    and the form is

    <div id="promocode">
    <form>
    email: <input type="text" name="email" />
    <input class="button" type="submit" />
    </form>
    </div>

    It works almost as expected. Filling in anything and clicking submit replaces the “promocode” div html. But then the page refreshes and resets to the input field. Any idea how to stop that happening?

  • The topic ‘page refresh after jquery’ is closed to new replies.