Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap-multiselect
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap-multiselect
Commits
1bf82fcd
Commit
1bf82fcd
authored
Nov 08, 2013
by
David Stutz
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #179 from esdrasedu/master
Add function to customize label of itens.
parents
1da1db9a
72eca522
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
index.html
index.html
+17
-0
bootstrap-multiselect.js
js/bootstrap-multiselect.js
+5
-1
No files found.
index.html
View file @
1bf82fcd
...
...
@@ -610,6 +610,23 @@
buttonContainer:
'<
span class="dropdown" /
>'
});
});
<
/script
>
</pre>
</td>
</tr>
<tr>
<td><code>
label
</code></td>
<td>
Function to write the label of the item.
</td>
<td>
<pre
class=
"prettyprint linenums"
>
<
script type=
"
text/javascript
">
$(document).ready(function() {
$(
'
.multiselect
'
).multiselect({
label: function(element) {
return $(element).html()+
'
(
'
+$(element).val()+
'
)
'
;
}
});
});
<
/script
>
</pre>
</td>
...
...
js/bootstrap-multiselect.js
View file @
1bf82fcd
...
...
@@ -91,6 +91,10 @@
return
selected
.
substr
(
0
,
selected
.
length
-
2
);
}
},
// Create label
label
:
function
(
element
){
return
$
(
element
).
attr
(
'
label
'
)
||
$
(
element
).
html
();
},
// Is triggered on change of the selected options.
onChange
:
function
(
option
,
checked
)
{
...
...
@@ -322,7 +326,7 @@
}
// Support the label attribute on options.
var
label
=
$
(
element
).
attr
(
'
label
'
)
||
$
(
element
).
html
(
);
var
label
=
this
.
options
.
label
(
element
);
var
value
=
$
(
element
).
val
();
var
inputType
=
this
.
options
.
multiple
?
"
checkbox
"
:
"
radio
"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment