मैं jqueryui sortable विजेट का उपयोग कर रहा हूं। मुझे वर्तमान ड्रैग किए गए तत्व के डेटा एट्रिब्यूज़ प्राप्त करने की आवश्यकता है। $ (यह) .डेटा ('attribute_name') यहां काम नहीं कर रहा है। मैंने कुछ अन्य तरीकों का भी प्रयास किया है, लेकिन सही परिणाम नहीं मिला है।jQuery सॉर्ट करने योग्य - वर्तमान ड्रैग किए गए तत्व को कैसे प्राप्त करें
एचटीएमएल
<ul class="draggable-item" style="min-height:10px;">
<li data-parent="31" data-id="81" class="ui-state-default">Label</li>
<li data-parent="31" data-id="86" class="ui-state-default">Max Value</li>
<li data-parent="31" data-id="83" class="ui-state-default">Unit</li>
<li data-parent="31" data-id="84" class="ui-state-default">Warning Level High</li>
<li data-parent="31" data-id="85" class="ui-state-default">Warning Level Low</li>
</ul>
जे एस
$(document).ready(function() {
$(".draggable-item").sortable({
start: function(event, ui) {
//Here i need to get current dragged element's 'parent' attribue.
//console.log(ui.item[0].attributes); - Here i got the entire attribute values in an array. But the order of the array is different in browsers.
},
}).disableSelection();
});
आपको बहुत बहुत धन्यवाद, यह समस्याओं के बिना पूरी तरह से काम करता है। –