2016-03-04 66 views
0

我在我的管理面板中爲我的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

+0

我能夠通過複製來解決我的問題,然後重新粘貼在 無功配置= { 「.chosen選」:{}, 」 .chosen - 選擇 - 取消選擇':{allow_single_deselect:true}, '.chosen-select-no-single':{disable_search_threshold:10}, '.chosen-select-no-results':{no_results_text:'Oops,nothing found!'} , '.chosen-select-width':{width:「95%」} } ... 代碼位於我的post_form底部 –

回答

0

我能夠通過複製來解決我的問題,然後重新粘貼了var配置= { '.chosen選':{} ,'.chosen-select-deselect':{allow_single_deselect:true},'.chosen-select-no-single':{disable_search_threshold:10},'.chosen-select-no-results':{no_results_text:'Oops,沒有發現!'},'.chosen-select-width':{width:「 95%「}} ...代碼在我的post_form的底部,它來自所選的jquery。