如何将css类调用到javascript中
我曾尝试将该插件用于select,但在javascript中插入该类时,css插件类不起作用:如何将css类调用到javascript中,javascript,css,Javascript,Css,我曾尝试将该插件用于select,但在javascript中插入该类时,css插件类不起作用: $('.search-test').SumoSelect({ search: true, searchText: 'Please enter the appropriate keywords...', noMatch: 'Sorry, the data you are looking for is not found, please enter the appropriate
$('.search-test').SumoSelect({
search: true,
searchText: 'Please enter the appropriate keywords...',
noMatch: 'Sorry, the data you are looking for is not found, please enter the appropriate keywords, the data you are looking for: "{0}"',
// up: false
});
我想使用javascript使用的插件:
$('.search-test').SumoSelect({
search: true,
searchText: 'Please enter the appropriate keywords...',
noMatch: 'Sorry, the data you are looking for is not found, please enter the appropriate keywords, the data you are looking for: "{0}"',
// up: false
});
javascript代码:
$(document).ready(function() {
var count = 0;
$(document).on('click', '.add', function() {
count++;
var html = '';
html += '<tr>';
html += "<td>"+"<select class='search-test' id='search-test'><option>a</option></select>" + "</td>";
html += '</tr>';
$('tbody').append(html);
});
$(document).on('click', '.remove', function() {
$(this).closest('tr').remove();
});
$('#insert_form').on('submit', function(event) {
var form_data = $(this).serialize();
if (error == '') {
$.ajax({
url: "request/create",
method: "POST",
data: form_data,
success: function(data) {
if (data == 'ok') {
$('#item_table').find('tr:gt(0)').remove();
$('#error').html('<div class="alert alert-success background-success">Success insert the data!</div>');
}
}
});
} else {
$('#error').html('<div class="alert alert-danger background-danger">' + error + '</div>');
}
});
});
$(文档).ready(函数(){
var计数=0;
$(文档)。在('单击','添加',函数()上){
计数++;
var html='';
html+='';
html++=“+”a“+”;
html+='';
$('tbody').append(html);
});
$(文档)。在('单击','删除',函数()上){
$(this).closest('tr').remove();
});
$(“#插入表格”)。在('submit',函数(事件){
var form_data=$(this).serialize();
如果(错误=“”){
$.ajax({
url:“请求/创建”,
方法:“张贴”,
数据:表格数据,
成功:功能(数据){
如果(数据=='ok'){
$('#item_table')。查找('tr:gt(0)')。删除();
$('#error').html('Success insert the data!');
}
}
});
}否则{
$('#error').html(''+error+'');
}
});
});
我的问题解决了,我不小心放置了jquery.min.js的版本你说不工作是什么意思?样式不适用于SelectElement吗?当我调用该类时,SumoSelect插件的css设计不起作用。您是否检查了样式文件。它加载正确吗?是的,我已经检查过了,但它不工作