Hello everyone!...
I have one or more couples of YES - NO buttons made with <span> tags... precisely:
- <label id='label-btn-yes_"+button_counter+"' class='ui-button ui-button-icon-only ui-widget ui-state-default ui-btn-expand-yes_"+button_counter+" '><span id='span-btn-yes_"+button_counter+"' class='ui-button-icon-primary ui-icon ui-icon-plusthick' onClick='expandYes(this,"+row_id+")'></span><span id='span-txt-yes_"+button_counter+"' class='ui-button-text'>Button</span></label>
- <label id='label-btn-no_"+button_counter+"' class='ui-button ui-button-icon-only ui-widget ui-state-default ui-btn-expand-no_"+button_counter+" '><span id='span-btn-no_"+button_counter+"' class='ui-button-icon-primary ui-icon ui-icon-plusthick' onClick='expandNo(this,"+row_id+")'></span><span id='span-txt-no_"+button_counter+"' class='ui-button-text'>Button</span></label>
I tried to code like this to toggle buttons:
- $(selector).removeClass("ui-icon-plusthick").addClass("ui-icon-minusthick").addClass("button-pressed").next().addClass("button-pressed");
if ( $(selector).attr("id") != $(node).find('.ui-icon-minusthick').attr("id") )
$(node).find('.ui-icon-minusthick').removeClass("ui-icon-minusthick").addClass("ui-icon-plusthick").removeClass('button-pressed').next().removeClass('button-pressed');
where $(selector) is the current "button" I am pressing at the moment
and $(node) is the button found in the pressed state to toggle back to
unpressed state.
When the "button" that's pressed is DIFFERENT from the current button
I am pressing then it's ok and it works great, but my issue is when I
press the SAME "button" looks like it toggles to unpressed but it goes
back to pressed state...
So is there an elegant way to toggle the SAME button and make it remain unpressed if it was previously in pressed state?
You can see a test sample at
http://nunzioluigi.com/test/test.php (in the source code you can see the jquery code I'm using to toggle buttons).. maybe it isn't the good way? any suggest?...
Thanks in advance to all!
ciao,
Luigi