使用jQuery选择时,将文本添加到列表项中 [英] Add text into a list item when selected using jQuery

查看:60
本文介绍了使用jQuery选择时,将文本添加到列表项中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery UI可拖动和可排序,当我点击要移动的项目时,我希望能够在li中添加文本,它显示了放置项目的位置,我已经设置了以下内容来演示:' -

I am using jQuery UI dragable and sortable, when I click the item to move, I want to be able to add text inside an li it shows where to place the item, I have setup the below to demonstrate:' -

http://jsfiddle.net/uJcB7/191/

干杯

推荐答案

绑定sortable的 开始 事件:

Bind sortable's start event:

$(function() {
    $( "#sortable" ).sortable({
        placeholder: "ui-state-highlight",
        start: function(event, ui) { 
          $("li.ui-state-highlight").text("your text");
        }
    });
    $( "#sortable" ).disableSelection();
});

提琴

这篇关于使用jQuery选择时,将文本添加到列表项中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆