I'm loading form into jquery-ui dialog using jquery.html() function and then Submitting doesn't work (alert doesnt show) - can someone tell me why?
here it is: http://jsfiddle.net/GMcev/11/
I'm loading form into jquery-ui dialog using jquery.html() function and then Submitting doesn't work (alert doesnt show) - can someone tell me why?
here it is: http://jsfiddle.net/GMcev/11/
You need delegate event. Because your button is added to DOM after page load ie. dynamically, so you need something like following:
$('body').on('click', '.button', function() {
alert('TEST!'); //it doesnt work
});
Call
$(".button").click(function() {
alert('aaa');
in open action of dialog
$("#dialog").dialog({
autoOpen: false,
title: "contact",
open: function() {
$(".button").click(function() {
alert('aaa');
});
}
});
i suggest to put onclick in submit button
<input type='submit' name='submit' class='button'
id='submit' value='Zapisz' onclick='dingDong()' />
type="submit"
, on clicking , it is submitting form