How do I get the dragable element in jquery-ui?
<div class="draggable">1</div>
<div class="draggable">2</div>
<div class="draggable">3</div>
<div class="draggable">4</div>
<div class="draggable">5</div>
This is
$('.draggable').draggable({
stop: function() {
start=$(this).text();// I want to get text here
console.lgo(t);
}
});
I'd like to do it like this.
javascript jquery jquery-ui
Except for spelling mistakes with console.lgo
, the code is correct.You can run the code snippet below to see the results on the browser console.
$('.draggable').draggable({
stop: function() {
start=$(this).text();
console.log(t);
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<div class="draggable">1</div>
<div class="draggable">2</div>
<div class="draggable">3</div>
<div class="draggable">4</div>
<div class="draggable">5</div>
© 2024 OneMinuteCode. All rights reserved.