这里的测验类型我想在1个文本框中的任何一个中删除任何1个选项(a),(b),(c),(d)............. .................................................. .................................................. .................................................. .................................................. .................................................. .... jsfiddle是http://jsfiddle.net/5DCZw/962/
<div class="ans_set1">
<input type="text" maxlength="10" class="ans_set1_1" />
<br><input type="text" maxlength="0" class="ans_set1_2" />
<br><input type="text" maxlength="0" class="ans_set1_3" />
<br><input type="text" maxlength="0" class="ans_set1_4" />
</div>
<div class="abcd">
<div class="a" id="draggable"><b>(a)</b>
</div>
<div class="b" id="draggable"><b>(b)</b>
</div>
<div class="c" id="draggable"><b>(c)</b>
</div>
<div class="d" id="draggable"><b>(d)</b>
</div>
</div>
$(document).ready(function () {
$(function () {
$(".a,.b,.c,.d").draggable({
revert: true,
helper: 'clone',
start: function (event, ui) {
$(this).fadeTo('fast', 0.5);
},
stop: function (event, ui) {
$(this).fadeTo(0, 1);
}
});
$(".ans_set1_1,.ans_set1_2,.ans_set1_3,.ans_set1_4").droppable({
accept: ".a,.b,.c,.d",
drop: function (event, ui) {
}
});
});
} );
jsfiddle is http://jsfiddle.net/5DCZw/962/
答案 0 :(得分:1)
http://jsfiddle.net/5DCZw/963/
$(document).ready(function () {
$(function () {
$(".a,.b,.c,.d").draggable({
revert: true,
helper: 'clone',
start: function (event, ui) {
$(this).fadeTo('fast', 0.5);
},
stop: function (event, ui) {
$(this).fadeTo(0, 1);
}
});
$(".ans_set1_1,.ans_set1_2,.ans_set1_3,.ans_set1_4").droppable({
accept: ".a,.b,.c,.d",
drop: function (event, ui) {
var $answer=ui.draggable;
var $input=$(event.target);
var val=$answer.text()
$input.val(val);
}
});
});
});