Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Problem getting css class added to element.


nelsonm - 2:07 pm on Jun 4, 2012 (gmt 0)


hi all,

i have this button set in the following html segment. The set is part of a jquery dialog. I'm trying to add a class to but the first button in the set but it does not appear in firebug. Can someone tell me what's wrong with my selector?

$('#workorder-window.ui-dialog-buttonset button').first().addClass('submit');


It's included in the jquery dialog definition that follows:

$('#workorder-button').click(function() {$('#workorder-window').dialog({
open: function(event, ui) {$('#workorder-window.ui-dialog-buttonset button').first().addClass('submit');
$('#workorder-window').validationEngine('attach', {promptPosition : 'topLeft', scroll: false});},
close: function(event, ui) {$('#workorder-window').validationEngine('hideAll');},
buttons: {'Submit': function() {if (jQuery('#workorder-window').validationEngine('validate')) {/* … do something */}}}
});
});


to add the class to the first button in the set...

<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<div id="workorder-window" class="bkgdcolor ui-corner-all-y ui-widget-content ui-dialog-content" style="width: auto; min-height: 209.4px; height: auto;" scrolltop="0" scrollleft="0">
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">

<div class="ui-dialog-buttonset">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
</div>

</div>
</div>

[edited by: tedster at 4:50 pm (utc) on Jun 4, 2012]
[edit reason] prevent side-scroll [/edit]


Thread source:: http://www.webmasterworld.com/javascript/4461224.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com