我在我的管理面板中为我的post_form页面上的客户端字段使用它的问题。它适用于我的artist_form客户端,但在浏览器的检查器中,它在post_form页面上显示错误。第一个屏幕截图来自post_form,出现错误,第二个来自artist_form,我的插件工作正常,第三个插件无法发布,因为我没有足够的信誉,因为我是新手将从我的header.php中发布到chosen.css文件的链接。如果你能帮助我解决这个问题,我将不胜感激。jQuery选择Css问题
The first screenshot is from the post_form with the error
the second is from the artist_form where I have the plugin working
<script type="text/javascript">
// Post Form Validate
\t $(document).ready(function() {
\t \t $('#postForm').validate({
\t \t \t errorElement: "div",
\t \t \t rules: {
\t \t \t name: { required: true },
\t \t \t details: { required: true },
\t \t \t category: { required: true }
\t \t \t }
\t \t });
\t \t $('#restform').click(function(){
$('#postForm')[0].reset();
\t \t });
\t });
// Chosen multi-select
\t var config = {
\t '.chosen-select' : {},
\t '.chosen-select-deselect' : {allow_single_deselect:true},
\t '.chosen-select-no-single' : {disable_search_threshold:10},
\t '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
\t '.chosen-select-width' : {width:"95%"}
\t }
\t for (var selector in config) {
\t $(selector).chosen(config[selector]);
\t }
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>World Music Listing: Master Admin</title>
<link rel="stylesheet" href="public/css/screen.css" type="text/css" media="screen" title="default" />
<link rel="stylesheet" href="public/css/chosen.css">
<!--[if IE]>
<link rel="stylesheet" media="all" type="text/css" href="css/pro_dropline_ie.css" />
<![endif]-->
<!-- jquery core -->
<script src="public/js/jquery/jquery.min.js" type="text/javascript"></script>
<script src="public/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="public/js/chosen.jquery.min.js" type="text/javascript"></script>
</head>
\t \t \t \t \t <tr> \t \t \t \t \t
\t \t \t \t \t \t <th valign="top">Client:</th>
\t \t \t \t \t \t <td>
\t \t \t \t \t \t <?php \t
\t \t \t \t \t \t \t $host_name = "localhost";
\t \t \t \t \t \t \t $database = "#my database name"; \t \t
\t \t \t \t \t \t \t $username = "#my admin user name"; \t \t
\t \t \t \t \t \t \t $password = "#my password for the admin user"; \t \t
\t \t \t \t \t \t \t //////// Do not Edit below /////////
\t \t \t \t \t \t \t try {
\t \t \t \t \t \t \t \t $dbo = new PDO('mysql:host='.$host_name.';dbname='.$database, $username, $password);
\t \t \t \t \t \t \t \t } catch (PDOException $e) {
\t \t \t \t \t \t \t \t print "Error!: " . $e->getMessage() . "<br/>";
\t \t \t \t \t \t \t die();
\t \t \t \t \t \t \t }
\t \t \t \t \t \t \t // Select all artists (clients) and order by name //
\t \t \t \t \t \t \t $sql="SELECT aname FROM tbl_music_artists ORDER BY aname";
\t \t \t \t \t \t \t // multi-select dropdown - select which artists (clients) receive posts //
\t \t \t \t \t \t ?> \t
\t \t \t \t \t \t \t <select name="userids[]" class="chosen-select" data-placeholder="Choose a Client..." style="width:350px;" multiple>
\t \t \t \t \t \t <?php
\t \t \t \t \t \t \t foreach ($dbo->query($sql) as $row){
\t \t \t \t \t \t \t echo "<option value=$row[id]>$row[aname]</option>";
\t \t \t \t \t \t \t }
\t \t \t \t \t \t ?>
\t \t \t \t \t \t \t </select>
\t \t \t \t \t \t </td>
\t \t \t \t \t </tr> \t \t
我能够通过复制来解决我的问题,然后重新粘贴在代码位于我的post_form底部 –