Anukul
Anukul

Reputation: 57

jQuery .one not working

Code that I use and many times it creating problem in Firefox & IE11.

$("#systemsetting").one("click", function(){
     var p = $(this).attr('href');
        var action = p;
        var form = $(document.createElement('form')).attr('action', action).attr('method','post');
        $('body').append(form);
        $(document.createElement('input')).attr('type', 'hidden').attr('name', "requestId").attr('value', requestId).appendTo(form);
        $(form).submit();
        return false;
});

Upvotes: 1

Views: 803

Answers (1)

KoemsieLy
KoemsieLy

Reputation: 722

Try this:

$("#systemsetting").click(function(){
    var clicked = $("#systemsetting").hasClass("clicked");
    if(!clicked) {
        $(this).addClass("clicked");
        var p = $(this).attr('href');
        var action = p;
        var form = $(document.createElement('form')).attr('action', action).attr('method','post');
        $('body').append(form);
        $(document.createElement('input')).attr('type', 'hidden').attr('name', "requestId").attr('value', requestId).appendTo(form);
        $(form).submit();
        return false;
    }
});

Upvotes: 1

Related Questions