![]() |
How to select multiple input to remove from the list
Hi,
I have the code , which add the data from input filed to list-box.Now am able to remove individual input's. I want to have option multiple select to remove the data from list box . Am not able to process all the data whichever are present in select tag:( CODE: Code:
<form id="frm" action="" method="post"> Please Help Thank You Pervez |
If you post any code please put it in between [CODE][/CODE] tags. It makes scanning your posts much easier. You can do this by clicking the small ‘#’ icon above the reply field.
|
FYI: if you hit "enter" after typing a name into the input box, it disappears from that box and completely removes every name in the select list. Not a good thing.
|
generally speaking you loop through the options (using a reverse for loop) and if the option is selected, remove it.
if you need more detail, feel free to ask. |
Hi ,
Sorry I didn't get you. can u bit clear about this ......? And also I wanna process this select list to back end for further process .How can I add multiple data to select list at a time and process this .......? Thank You Pervez |
you have to add "multiple" in the select tag to select multiple value. As I have added below:
<select multiple name="sel_list" id="sel_list" size="2" onchange="adOption.selOpt(this.value, 'optval')"></select><br/><br/> Also, you have to update your delete function. Please see below: adOption.delOption = function(list, optval) { var opts = document.getElementById(list).getElementsByTagName('option');; for(var i=opts.length -1; i >= 0 ; i--) { if(opts[i].selected == true) { document.getElementById(list).removeChild(opts[i]); } } } Let me know is this you want? |
Hi shyagrawal,
Thank You for your response. When I update my code as you told , the list box not taking input from input filed . And also i wann process all those list box items to back-end. Please Help Thank You Pervez |
use below code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
Hi shyagrawal,
Thank You for your response. When I update my code as you told , the list box not taking input from input filed . And also i wann process all those list box items to back-end. Please Help Thank You Pervez |
Please correct my understanding. You want to delete entered text from the select list, right?
For Example, If you enter "test" in the text box and "test" is present in list box, then you want to delete that option from select box, right? In that case, you can delete only options whose value is "test" in the select list. |
| All times are GMT +1. The time now is 01:49 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.