Select 2 Not Working on my Website

44 views
Skip to first unread message

Brad

unread,
Aug 24, 2017, 11:33:37 AM8/24/17
to select2
I followed the instructions exactly how they were posted on the select2 website, and it refuses to work on my website. Loading it on a website seems simple enough, so I don't know what could be causing the issue. Has anyone else dealt with this before? I'll copy my code below if it helps.

<?php
/*==================================================================================
README:

This global var (`root_dir`) must be set to the relative path
of the root directory.

E.g.
If this page is in "career.clemson.edu/coop/"
then the line should read
$GLOBALS["root_dir"]="../";
or if this page is in "career.clemson.edu/coop/students/";
then the line should read
$GLOBALS["root_dir"]="../../";


The template automatically includes common meta elemtents (keywords, etc),
common CSS files (ours, bootstrap, font-awesome), a fallback fon non-HTML5 compliant
browsers, and some basic javasript files at the end of the page.
Feel free to add any other things as needed on a per page basis!

All includes *should* in %root_dir%/includes


==================================================================================*/
$GLOBALS["root_dir"]="../";
require_once $GLOBALS["root_dir"].'includes.inc';
?>
<!doctype html>
<html lang="en">
<html><head>
<meta charset="UTF-8">
<?php
require_once $GLOBALS['include_loc']."common_meta.inc";
require_once $GLOBALS['include_loc']."common_css.inc";
require_once $GLOBALS['include_loc']."html5_shiv.inc";
?>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css">

<title>Resumes and Cover Letters</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!-- jQuery library -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <!-- Latest compiled JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>


</head>

<body>
<?php require_once $GLOBALS["include_loc"]."top_menu.inc";?> <!-- Top Menu -->
<div class span="row">
<script type="text/javascript">
$(".js-example-placeholder-multiple").select2({
placeholder: "Select a state"
});
</script>
<select class="js-example-placeholder-multiple">
<option value="AL">Alabama</option>
...
<option value="WY">Wyoming</option>
</select>
</div>



<?php require_once $GLOBALS["include_loc"]."footer.inc";?> <!-- Footer -->
<?php require_once $GLOBALS['include_loc']."basic_js.inc"; ?> <!--Include JS Files at the end for speed-->
</body>
</html>

bra...@g.clemson.edu

unread,
Aug 24, 2017, 11:34:50 AM8/24/17
to select2, bra...@g.clemson.edu
On Thursday, August 24, 2017 at 11:33:37 AM UTC-4, Brad wrote:
> I followed the instructions exactly how they were posted on the select2 website, and it refuses to work on my website. Loading it on a website seems simple enough, so I don't know what could be causing the issue. Has anyone else dealt with this before? I'll copy my code below if it helps. This code displayed a drop down menu on my website with static CSS and not the bootstrap appearance, and I don't know why. It's also missing the search feature that I am after the most.
Reply all
Reply to author
Forward
0 new messages