I've been struggling with binding a jquery click method to a specific button in a jquery dialog because i can't get the selector right.
I want to specifically target all jquery dialog submit buttons. I have the following selector set up that works for the first button in the buttonset but the submit button is not always the first button in the set.
What i'd like to do is bind the click method to the button in the ui-dialog-buttonpane who's span element text is "Submit". This way the click method will always work on the submit button even if another button is added to the dialog iu-dialog-buttonpane.
The only unique thing in the dynamically generated jquery dialog button pane is the name of the buttons contained as text in the span tag for each button.
I wrote the selector to the console.log. It appears that jquery is ignoring the :parent selector. i removed :parent from $(this).find(".ui-button-text:contains('Submit')").click(); and it still worked. The click method appears to be bound to the span tag - but it still works.
it appears that: $(".ui-button-text:contains('Submit')").parent().click(); or $(this).find(".ui-button-text:contains('Submit')").parent().click(); also work and both (minus the .click) resolve to "button.ui-button".