jeudi 27 août 2015

jquery reloads the page when button is clicked

I've a get route, that returns a view with data, the view has a form (I'm using LaravelColletive's html package), that form has a button that's not the submit one, this button has an click event triggered by jQuery, what it does it that it appends some elements to the view.

The problem I'm having is that when I click on the button it reloads the page, the action is made, but because of the reload the page form has no value again.

Here's the jquery action

    $("#completarseleccion").click(function(){
    var btn_element = $(this);
    //this is how you loop through your item and add it to a specific element
    $(".opcion").each(function(){
        if($(this).hasClass("clicked")){
            $($(this).html()).append('#menuseleccionado');
        }
    });
});

Actually if the button has no action, if I click it, it reloads the page...

My application is under laravel 5.0 How could I solve that?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1JliKOx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire