Jquery UI Drag And Drop add check mark to grid on drop -
a quick question maybe know answer.
i have drag , drop , have grid box next needed data check, when draggable dropped in want tick , when it's dragged out want untick not sure use tried on function jquery ui did not work.
$('#td2').droppable({ accept: "#r3,#r4", over: function( event, ui ) { $('#q1v1_1').attr('checked', true); $('#q1v1_1').prop('checked', true); }
you should using drop
event instead of over
event. when using over
, checkmark appear on every cell drag over.
$('#td2').droppable({ accept: "#r3,#r4", drop: function( event, ui ) { var $el = $(event.target), draggable = ui.draggable, drid = draggable.attr("id"); // if dropping in td , checkbox child if (drid === "r4") { $el.find("input[type=checkbox]").attr('checked', 'checked'); } } });
Comments
Post a Comment