简体   繁体   中英

jQuery Chosen Css Issue

I having an issue of using it on my post_form page in my admin panel for the Client: field. It works on my artist_form for clients, but in the inspector of my browsers it is showing an error on the post_form page. The first screenshot is from the post_form with the error, the second is from the artist_form where I have your fine plugin working, and the third which I am unable to post being I don't have enough reputation here as I am new to this site would be from my header.php where the link to the chosen.css file is posted. If you can assist me with resolving this issue I would greatly appreciate it.

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 $(document).ready(function () { $('#postForm').validate({ errorElement: "div", rules: { name: { required: true }, details: { required: true }, category: { required: true } } }); $('#restform').click(function(){ $('#postForm')[0].reset(); }); }); // Chosen multi-select var config = { '.chosen-select' : {}, '.chosen-select-deselect' : {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%"} } for (var selector in config) { $(selector).chosen(config[selector]); } </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> 
  <tr> <th valign="top">Client:</th> <td> <?php $host_name = "localhost"; $database = "#my database name"; $username = "#my admin user name"; $password = "#my password for the admin user"; //////// Do not Edit below ///////// try { $dbo = new PDO('mysql:host='.$host_name.';dbname='.$database, $username, $password); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); } // Select all artists (clients) and order by name // $sql="SELECT aname FROM tbl_music_artists ORDER BY aname"; // multi-select dropdown - select which artists (clients) receive posts // ?> <select name="userids[]" class="chosen-select" data-placeholder="Choose a Client..." style="width:350px;" multiple> <?php foreach ($dbo->query($sql) as $row){ echo "<option value=$row[id]>$row[aname]</option>"; } ?> </select> </td> </tr> 

通过复制并重新粘贴var config = {'.chosen-select':{},'.chosen-select-deselect':{allow_single_deselect:true},'.chosen-select-no,我能够解决我的问题-single':{disable_search_threshold:10},'.chosen-select-no-results':{no_results_text:'糟糕,什么都找不到!'},'.chosen-select-width':{width:“ 95%”} } ...位于我的post_form底部的代码,该代码来自所选的jquery。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM