I made a list of fruits and vegetables that the user is supposed to drag&drop into two separate divs. Here's a relevant piece of the code (which is almost the copy of the code from this tutorial video: https://www.youtube.com/watch?v=-JFkAaLOou8中“name”属性的安全替代方法:
<script>
$(document).ready(function (){
$("#source li").draggable({
helper: 'clone',
revert: 'invalid'
});
$("#fruits1").droppable({
accept: 'li[data-value="fruit"]',
drop: function (event, ui){
$("#fruits2").append(ui.draggable);
}
});
$("#vegetables1").droppable({
accept: 'li[data-value="vegetable"]',
drop: function (event, ui){
$("#vegetables2").append(ui.draggable);
}
});
<script>
HTML:
<div>
<ul id="source">
<li data-value="fruit">Banana</li>
<li data-value="fruit">Strawberry</li>
<li data-value="fruit">Pear</li>
<li data-value="vegetable">Lettuce</li>
<li data-value="vegetable">Carrot</li>
<li data-value="vegetable">Cauliflower</li>
</ul>
</div>
<div id="fruits1">
<ul id="fruits2">
</ul>
</div>
<div id="vegetables1">
<ul id="vegetables2">
</ul>
</div>
我想添加一个“重置”按钮,在用户完成拖动之后将所有内容都带到原始位置。删除列表元素。我怎么做?我尝试过这样的事情:
$("#fruits2").remove();
$("#vegetables2").remove();
或:
$("#source li").css({"left":"","top":""});
但它似乎不起作用。
答案 0 :(得分:0)
你可以通过以下方式实现这一目标:
mysqli_query($connection, "INSERT INTO tbl_used (message_ID,timeOfUse) VALUES($msgID, NOW())");
答案 1 :(得分:0)
我已经看到很多人都面临这种问题,人们在猜测而不是帮助我们了解精确的解决方案。
在这里,我做了一个小提琴,以重置通过一次单击随机拖动的多个对象。 I/flutter (25205): URL https://api.openbrewerydb.org/breweries?by_city=Austin
I/flutter (25205): [{"id":6780,"name":"Jester King Brewery","brewery_type":"micro","street":"13187 Fitzhugh Rd","city":"Austin","state":"Texas","postal_code":"78736-6510","country":"United States","longitude":"-98.0824692","latitude":"30.2547264","phone":"5125375100","website_url":"http://www.jesterkingbrewery.com","updated_at":"2018-08-24T16:21:26.875Z","tag_list":[]},{"id":6822,"name":"Oasis Texas Brewing Company","brewery_type":"micro","street":"6548 Comanche Trl Ste 301","city":"Austin","state":"Texas","postal_code":"78732-1210","country":"United States","longitude":"-98.151206","latitude":"30.043267","phone":"5122849407","website_url":"http://www.otxbc.com","updated_at":"2018-08-24T16:22:10.184Z","tag_list":[]},{"id":6631,"name":"Barking Armadillo Brewing","brewery_type":"planning","street":"","city":"Austin","state":"Texas","postal_code":"78723-3342","country":"United States","longitude":null,"latitude":null,"phone":"","website_url":"","updated_at":"2018-08-11T21:39:46.076Z","tag_list":[]},{"id":6632,"name":"Barrel Assem
E/flutter (25205): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>'
E/flutter (25205): #0 Network.getBreweryModel (package:brewery_app/network/network.dart:15:41)
E/flutter (25205): <asynchronous suspension>
E/flutter (25205): #1 _BreweryState.initState (package:brewery_app/main.dart:31:31)
E/flutter (25205): #2 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4640:58)
E/flutter (25205): #3 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (25205): #4 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #5 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #6 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
E/flutter (25205): #7 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #8 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #9 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (25205): #10 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (25205): #11 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
E/flutter (25205): #12 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (25205): #13 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #14 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #15 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
E/flutter (25205): #16 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #17 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #18 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
E/flutter (25205): #19 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #20 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #21 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (25205): #22 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
E/flutter (25205): #23 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (25205): #24 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
E/flutter (25205): #25 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4666:11)
E/flutter (25205): #26 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (25205): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #29 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
E/flutter (25205): #30 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #31 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #32 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
E/flutter (25205): #33 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #35 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (25205): #36 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
E/flutter (25205): #37 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (25205): #38 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
E/flutter (25205): #39 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4666:11)
E/flutter (25205): #40 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (25205): #41 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (25205): #42 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (25205): #43 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (25205): #44 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (25205): #45 ComponentElement._firstBuild (package:flutter
https://jsfiddle.net/JunaidAli/wp1n796q/321/