Hi,
I want the user to select only one item at the same time in a select object (listbox). How do I disable the multiple selection? Is there an inbuilt way to do this?
Basically it's an object (Type: Select) with Multiple: Yes (by setting this, I see more than one item at a time) but without the attribute "multiple."
Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Listbox - select one item only
Re: Listbox - select one item only
toms,
Try this...
Steven
Try this...
Code: Select all
function stop_multiple(t){
var s = $("#" + t.id).val();
for(var i = 1 ; i < s.length ; i++){
$("#" + t.id + " option[value='" + s[i] + "']").remove();
}
}
Steven
You do not have the required permissions to view the files attached to this post.
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: Listbox - select one item only
Steven,
Thanks for the response. In the meantime, I have figured out another way by removing the multiple="multiple" attribute and adding a size.
By doing this, you can't select more than one item.
Thanks for the response. In the meantime, I have figured out another way by removing the multiple="multiple" attribute and adding a size.
By doing this, you can't select more than one item.
Code: Select all
$('#myselect').removeAttr('multiple');
$('#myselect').attr('size','5');