问题描述
我正在使用 http://jscolor.com/
我正在尝试将其附加到一些动态输入上,但无济于事.就动态加载而言,仅在用户单击某些内容后,输入才在页面加载时不存在.例如,我有一行数据,每一行都有不同的背景色.这行数据是使用ajax加载的.每行末尾都有一个编辑按钮.通过单击编辑按钮,它将为单击的行显示一个输入文本框.当用户单击输入文本框时,我想调用jscolor选择器.我该怎么办?
i'm trying to attach it to some dynamic inputs, but to no avail. dynamic inputs in terms of, on page load the input doesn't exist, only after the user click on something the input will become available. for example, I have a rows of data, and each row has different background color. this row of data are loaded using ajax. at the end of each row, there's an edit button. by clicking the edit button, it will display an input text box for the clicked row. I want to call the jscolor picker when the user clicks on the input text box. how can I do this?
谢谢
推荐答案
出于某种原因jscolor.init()对我不起作用,并查看了我调用的代码
For some reason jscolor.init() did not work for me, and looking at the code I called
jscolor.installByClassName("jscolor");
jscolor.installByClassName("jscolor");
功能.
所以...
$(document).ready(function() {
jscolor.installByClassName("jscolor");
});
希望有帮助
这篇关于在动态输入上使用jscolor.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!