pawel
pawel

Reputation: 6136

Can't submit form after jquery.html() into jquery ui dialog

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/

Upvotes: 0

Views: 178

Answers (3)

artis
artis

Reputation: 19

i suggest to put onclick in submit button

<input type='submit' name='submit' class='button' 
id='submit' value='Zapisz' onclick='dingDong()' />

http://jsfiddle.net/GexFz/1/

Upvotes: 2

thecodeparadox
thecodeparadox

Reputation: 87073

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            
});

DEMO

Upvotes: 2

U.P
U.P

Reputation: 7442

Call

$(".button").click(function() {  
            alert('aaa');

in open action of dialog

$("#dialog").dialog({
        autoOpen: false,
        title: "contact",
        open: function() {
            $(".button").click(function() {
                alert('aaa');
            });
        }
    });

Upvotes: 2

Related Questions