Skip to content

code not taking input dynamically #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shrutiakki opened this issue Mar 10, 2017 · 0 comments
Open

code not taking input dynamically #241

shrutiakki opened this issue Mar 10, 2017 · 0 comments

Comments

@shrutiakki
Copy link

`<!doctype html>

<title>Add options dynamically to bootstrap-select</title> <style type="text/css"> .dropdown-menu { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }

.dropdown-menu a {
overflow: hidden;
outline: none;
}

.additem input
{
border:0;
margin:-3px;
padding:3px;
outline: none;
color: #000;
width: 99%;
}

.additem:hover input
{
background-color: #f5f5f5;
}

.additem .check-mark
{
opacity: 0;
z-index: -1000;
}

.addnewicon {
position: relative;
padding: 4px;
margin: -8px;
padding-right: 50px;
margin-right: -50px;
color: #aaa;
}

.addnewicon:hover {
color: #222;
}
</style>

Add options dynamically to bootstrap-select

ADDING LABELS

Select Columns

Mustard Ketchup Relish

Select Type

Banana Peach Orange
©
<script src="http://code.jquery.com/jquery.js"></script> <script src="js/bootstrap.js"></script> <script src="plugins/bootstrap-select/js/bootstrap-select.js"></script> <script> $(function() { var content = " "; var divider = $('') .addClass('divider') .data('divider', true); var addoption = $('') .addClass('additem') .data('content', content) $('.selectpicker') .append(divider) .append(addoption) .selectpicker(); }); function addSelectItem(t,ev) { ev.stopPropagation(); var txt=$(t).prev().val().replace(/[|]/g,""); if ($.trim(txt)=='') return; var p=$(t).closest('.bootstrap-select').prev(); var o=$('option', p).eq(-2); o.before( $("", { "selected": true, "text": txt}) ); p.selectpicker('refresh'); } function addSelectInpKeyPress(t,ev) { ev.stopPropagation(); // do not allow pipe character if (ev.which==124) ev.preventDefault(); // enter character adds the option if (ev.which==13) { ev.preventDefault(); addSelectItem($(t).next(),ev); } } </script> ` please help me with this code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant