I am new to bootstrap. I do not understand why these simple multiselect options are not clickable.
EDIT
The first multiselect on the test-site below is the one in question. I have tested using Chrome and Firefox.
EDIT-2
I am also using angularjs and think there may be a conflict somewhere. I am in the process of testing this hypothesis out.
HTML
<head>
<link rel="stylesheet" href="css/bootstrap-multiselect.css" type="text/css"/>
<script src="js/bootstrap-multiselect.js"></script>
</head>
<label for="work-type" class="fixed50">Type:</label>
<select id="work-type" name="work-type[]" multiple >
<option value="fiction">Fiction</option>
<option value="non-fiction">Non-Fiction</option>
</select>
The only javascript referense:
JS
$("#work-type").multiselect();
Here is a link to my test-site.
You also need to introduce a js file and a css file.
See details:
http://davidstutz.github.io/bootstrap-multiselect/
Related
I am trying to create the front end for an web application. I already have the backend developed in python. I am new to this territory of web design/development
I have some html and javascript code which uses jQuery multiselect.css and jQuery multiselect.js to create a dropdown multiselect checklist. However I am confused with how i can change the style or position of the dropdown, as I am already using jQuery multiselect.css
I added the css and the js under the head tag
<link href="jquery.multiselect.css" rel="stylesheet">
<script src="jQuery.js"></script>
<script src="jQuery-MultiSelect-master/jquery.multiselect.js"></script>
And then I am creating the dropdown list in html and using jQuery to initialize it
<select id='testSelect1' multiple>
<option value='1'>Item 1</option>
<option value='2'>Item 2</option>
<option value='3'>Item 3</option>
<option value='4'>Item 4</option>
<option value='5'>Item 5</option>
</select>
<script src="./test.js"></script>
<script>
$('#testSelect1').multiselect({
columns: 4,
placeholder: 'Select Countries',
selectAll: true
});
</script>
This puts the multiselect on the left and makes the dropdown width as wide as the page width and height longer then needed. I am trying to modify it so that it would appear in the middle and the size of the dropdown isn't as bit and colour of the dropdown array is different
When you are adding styles and scripts to project it should look like this
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<!-- style goes here -->
</head>
<body>
<!-- scripts go here -->
</body>
</html>
Style always go on top of document, between <title></title> tags. It is recommended to put scripts just before <body> tag closes. Here you can read why
There is that..
If you want to style that dropdown firstly we need to see how does it look like right because we can't help you blindly. But you could do this
select {
<!-- style for select goes here -->
}
select option {
<!-- style for option goes here -->
if you want your select to be 300px wide you can add this
select {
width: 300px;
}
Again. Post some screenshots and update the question with it if this didn't help
SelectBoxIt allows you to replace ugly and hard-to-use HTML select boxes with gorgeous and feature rich drop downs.
I implemented the SelectBoxIt and the <select> inside my render(return()) method didn't recognize it.
I searched the web and found almost only one source on Github that I didn't understand its recommendation, you can help me on this point.
In brief, I concluded that SelectBoxIt naturally doesn't support ReactJS.
Hence we need a solution or trick for that.
Below is sample code from their website and used it completely in my project:
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>SelectBoxIt demo</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" />
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css" />
<link type="text/css" rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="http://gregfranko.com/jquery.selectBoxIt.js/css/jquery.selectBoxIt.css" />
</head>
<body>
<select name="test">
<option value="SelectBoxIt is:">SelectBoxIt is:</option>
<option value="a jQuery Plugin">a jQuery Plugin</option>
<option value="a Select Box Replacement">a Select Box Replacement</option>
<option value="a Stateful UI Widget">a Stateful UI Widget</option>
</select>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script src="http://gregfranko.com/jquery.selectBoxIt.js/js/jquery.selectBoxIt.min.js"></script>
<script>
$(function() {
var selectBox = $("select").selectBoxIt();
});
</script>
</body>
</html>
The following select was not affected:
<select
id="sel1"
// ref={s => { this.selectBox = s; }}
onChange={ event => this.onSelectChange(event.target.value) }
>
{options}
</select>
The <select name="test"> has worked when put it inside render(return()) but the <select id="sel1" > inside render(return()) has not been changed to be a SelectBoxIt shape. Note that I commented the ref={s => { this.selectBox = s; }} just to prevent the error to display.
Since this is a jquery plugin, you need to make sure to have it installed:
npm install -S jquery
Then you need to import this in your script :
import * as $ from 'jquery';
Now in your react component, apply the jquery initialization in componentDidMount. The only catch is that you need to use ref to find the node.
render() {
return <select ref={s => { this.selectBox = s; }} />
}
componentDidMount() {
$(this.selectBox).selectBoxIt();
}
Some reference here.
I found that reactJS didn't "catch" onChange of the select that is replaced with SelectBoxIt but it "catch" onClick. So for one project that use SelectBoxIt + ReactJS I've made onClick trigger from jQuery when select value is changed combined with react onChange event.
In script tag /index.html/:
$("select").on('change',function(){
$("select").trigger('click');
});
In reactJS /SelectBox.js/:
onClickHandled that check if value is changed.
Example here: https://github.com/gshishkov/selectBoxIt-reactjs
I know it is not very elegant solution, but it was fastest and working one.
I'm trying to manage select2 library in order to augment the capabilities of natives select html controls.
According to the official documentation (very compressed) it says that for using select2 you only need to download they CSS and JavaScript files and that is (and also, implicitly assumed, that you need jQuery).
So, there is a way of initializing select using HTML5 data attributes, but I am not getting it; I'm trying to follow their example. Perhaps I am missing some important note here.
Here is the HTML I am trying to do
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
</head>
<body>
<h1>Hello Select2</h1>
<div>
<select multiple id="a_select" data-tags="true" data-placeholder="Select an option" data-allow-clear="true" style="width:100%">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
</div>
</body>
</html>
Also a link to plunker, to have a live example ready to go. https://plnkr.co/edit/Xk101K3sowAYQwbRCFez?p=preview
PS: I can achieve the desired result thought JavaScript, but is quite annoying to don't know what is not working when i just followed the example on the official site.
You're not initializing Select2 anywhere... data-* attributes let you override default configuration, but you still need to kick off the plugin:
<script>$('select').select2();</script>
https://plnkr.co/edit/RPObSPVl8jlZgtedsK38?p=preview
I'm trying to style an HTML select menu with JQuery UI; but it simply isn't working. Here is a JSFiddle.
Below are stripped down examples of what I'm trying to accomplish.
Here's my HTML code:
<form action="#">
<fieldset>
<label for="parameterSelectMenu">Select a Parameter</label>
<select name="parameterSelectMenu" id="parameterSelectMenu">
<option value="volvo">Temperature Actual</option>
</select>
</fieldset>
</form>
<!-- A button to show JQuery is working... -->
<button id="clicker">A button element</button>
Here's the JavaScript:
$("#clicker").button();
$("#parameterSelectMenu").selectmenu();
In Firefox "selectmenu" is reported as not a function...
Updated FIDDLE
The problem is that you are using older version of jquery-ui in jsfiddle demo you have created which does not have support for the selectmenu plugin.
so you have to add the latest version plugin files as shown below:
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
I can't get it to do anything. The drop down just behaves normally. I've followed their instructions and created the simplest demo I could and still nothing works. I've checked my paths and put everything in the same directory to make sure everything is being found. I have jQuery being loaded first.
Here's the html file:
<!doctype html>
<html>
<head>
<title>Searchable</title>
<script src="jquery-1.9.1.js"></script>
<script src="jquery.searchabledropdown-1.0.8.src.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("select").searchable();
});
</script>
</head>
<body>
<select id="myselect">
<option value="0">Aardvark</option>
<option value="1">Beta</option>
<option value="2">Charlie</option>
<option value="3">Louis Chan</option>
<option value="4">Zoomba</option>
<option value="5">Lima</option>
</select>
</body>
</html>
Here's a link to the plugin. Demo is on the plugin page: http://jsearchdropdown.sourceforge.net/
this works for me:
<!doctype html>
<html>
<head>
<title>Searchable</title>
<script type="text/javascript" src="http://jsearchdropdown.sourceforge.net/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://jsearchdropdown.sourceforge.net//jquery.searchabledropdown.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("select").searchable();
});
</script>
</head>
<body>
<select id="myselect">
<option value="0">Aardvark</option>
<option value="1">Beta</option>
<option value="2">Charlie</option>
<option value="3">Louis Chan</option>
<option value="4">Zoomba</option>
<option value="5">Lima</option>
</select>
</body>
</html>
It seems like the $.browser has been removed from jquery 1.9 core and above see the reference here you can decide to fix the problem by changing the library, use an older jquery version or use another alternative here you can find some better examples.
Good luck!
I downloaded the code and tested it. The problem is jQuery 1.9.1, when I put that version it does not work, but when I put back jQuery 1.8.3 it works.
I don't think there is a way to solve it unless you dig in the library, so it's better to use 1.8.3 as in the demo.
For the above Example: Once you searched the key like 'Zoo..' then you can select 'Zoomba'. Again If want to change the selection, in that list you can able to see only 'Zoomba' not all values.
If you want to show all values in that list you have to clear that searched key once selected index changed. Like this,
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Searchable</title>
<script type="text/javascript" src="http://jsearchdropdown.sourceforge.net/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://jsearchdropdown.sourceforge.net//jquery.searchabledropdown.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#myselect').searchable();
$('#myselect').change(function() {
$(this).autocomplete('search', '');
});
});
</script>
</head>
<body>
<select id="myselect">
<option value="0">Aardvark</option>
<option value="1">Beta</option>
<option value="2">Charlie</option>
<option value="3">Louis Chan</option>
<option value="4">Zoomba</option>
<option value="5">Lima</option>
</select>
</body>
</html>
You written code is fine, It is a browser and Jquery version related issue.
Runs on IE 7.x, IE 8.x, Firefox 3.5.x, Safari 4.x, Opera 10.x, Chrome 3.x
It uses version Jquery 1.7.2 and Jquery UI 1.8.18
Also use plugin http://effinroot.eiremedia.netdna-cdn.com/repo/plugins/forms-controls/searchabledropdown/jquery.searchabledropdown.js
You can check the running version on JSFiddle
http://jsfiddle.net/JWyRZ/
You always can use jquery-browser-plugin plugin from https://github.com/gabceb/jquery-browser-plugin. It adds the functionality missed by upgrade to 1.9. Just make sure you load jquery first and jquery-browser plugin afterwards.