Pregunta

I had to use .live() because .on() or .submit() wouldn't fire

$('.submit_coment').live('submit',function(e){
    e.preventDefault();
    console.log('Submit Comment');
    return false;
});

The thing is that now the console.log is fired but the form is submited naturally (page refreshed)

Any idea why?

¿Fue útil?

Solución

jQuery mobile doesn't use standard requests, everything is done via AJAX handler which it attaches to every form. To prevent this you need to put the data-ajax="false" attribute on the form element. This will then allow you to hook to the submit event yourself and do as you need.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top