| 8:22 pm on Jul 2, 2012 (gmt 0)|
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 just can't figure out if this can be done.
| 10:58 pm on Jul 2, 2012 (gmt 0)|
How about this:
I haven't tried it, but I think that would do what you're trying to do.
| 11:48 pm on Jul 2, 2012 (gmt 0)|
Fotiman, thanks again - that worked.
I was reading up on the :contains() and :parent selectors in the jquery selector docs. I didn't realize you could combine them to get the parent (the button tag) of the span element tag.
How did you know you could combine them that way? Or am i just missing the point that they are merely selectors and selectors can be combined.
| 12:52 am on Jul 3, 2012 (gmt 0)|
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.
| 3:05 am on Jul 3, 2012 (gmt 0)|
Glad it worked. :) jQuery's selectors are pretty powerful, so I just figured that more accurately represented what you were trying to select.
| 4:43 am on Jul 3, 2012 (gmt 0)|
it appears that:
also work and both (minus the .click) resolve to "button.ui-button".