select2组件中所选元素的工具提示

 jp85201 发布于 2022-12-23 12:34

在我的项目中,我正在使用select2组件.对于我选择的元素,我添加了图标和说明.代码是这样的:

function format(profile_opt) {
        return profile_opt.text + "
" + $(profile_opt.element).attr('title') + "
" + ($(profile_opt.element).attr('start').length==0?'':('from: ' + $(profile_opt.element).attr('start') + '')) + ($(profile_opt.element).attr('end').length==0?'':(' to: ' + $(profile_opt.element).attr('end') + '')) + " /assignments_date_set.jsp\",\"" + profile_opt.id + "\",\"" + $(profile_opt.element).attr('start') + "\",\"" + $(profile_opt.element).attr('end') + "\")>" + "\"Set"; } function format2(profile_opt){ return profile_opt.text +"
" + $(profile_opt.element).attr('title') + ""; } $('#selected_profiles').select2({ allowSelectAllNone: true, closeOnSelect:false, width: '600px', placeholder: 'Click to select', formatResult: format2, formatSelection: format, escapeMarkup: function(m) { return m; } });

我的问题是:如何将工具提示设置为格式选项元素的子字符串.我的意思是我只需要开始提供工具提示而不是整个语法与html里面.在此先感谢您的帮助.

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有