Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $(document).ready(function()
- {
- $('#boxClear').click(function(){
- $('#firstFilterSearch').val('');
- });
- $('#firstFilterSearch').keyup(function()
- {
- var searchArea = $('#firstList');
- searchFirstList($(this).val(), searchArea);
- });
- $('#firstList').dblclick(function() {
- assignList();
- });
- $('#secondList').dblclick(function() {
- unassignList();
- });
- $('#to2').click(function()
- {
- assignList();
- });
- $('#to1').click(function()
- {
- unassignList();
- });
- });
- // Function for Filtering
- function searchFirstList(inputVal, searchArea)
- {
- var allCells = $(searchArea).find('option');
- if(allCells.length > 0)
- {
- var found = false;
- allCells.each(function(index, option)
- {
- var regExp = new RegExp(inputVal, 'i');
- if(regExp.test($(option).text()))
- {
- $(option).show();
- }
- else
- {
- $(option).hide();
- }
- });
- }
- }
- // function: UnAssignment
- function assignList()
- {
- $('#firstList :selected').each(function(i, selected){
- // append to second list box
- $('#secondList').append('<option value="'+selected.value+'">'+ selected.text+'</option>');
- // remove from first list box
- $("#firstList option[value='"+ selected.value +"']").remove();
- });
- }
- // function: UnAssignment
- function unassignList()
- {
- $('#secondList :selected').each(function(i, selected){
- // append to first list box
- $('#firstList').append('<option value="'+selected.value+'">'+ selected.text+'</option>');
- // remove from second list box
- $("#secondList option[value='"+ selected.value +"']").remove();
- });
- }
- </script>
Add Comment
Please, Sign In to add comment