I need to disable jQuery.toggle state (odd, even)

I have elements in a table cell that turn on and off.

The external button takes a click and passes the selected cell values ​​via ajax.

The problem is that I want to reset the switching state for the selected cells.

I can easily turn off the selection, but then I need to double-click to trigger the correct switch.

Can .toggle (odd, even) be reset or cyclically through an external call?

thank

+3
source share
3 answers

In the end, I decided this by choosing an already rearranged list of items.

Then I call .click on it.

, . .

+2

, ?



//reset the toggle state<br>
      $('#tablecell').unbind('click').toggle(fn1, fn2);<br>
      $('#tablecell').toggle(fn1, fn2);
+2

.toggle()is the same as alternating between .show()and .hide(), so just call .show()or .hide()depending on what the desired reset state is.

if you use .toggle()handlers to loop over, then just untie and recheck the switch event.

0
source

Source: https://habr.com/ru/post/1750058/


All Articles