/    Sign up×
Community /Pin to ProfileBookmark

Number of Select lists in div

Hi Folks,

Can anyone tell me how I can determine this using javascript?

Thankyou

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@Dr_FlinkJan 08.2007 — [CODE]function getNumSelects() {
var container = document.getElementById("myDiv");
var aSelects = container.getElementsByTagName("select");
return(aSelects.length);
}[/CODE]
Copy linkTweet thisAlerts:
@mattasticauthorJan 09.2007 — Thanks for your reply.

I would llike to add/ select list a select list by clicking a button. I'm not sure hoe to go about this. Can you help?

Thankyou
Copy linkTweet thisAlerts:
@Dr_FlinkJan 09.2007 — Maybe this thread might help you out?

[URL]http://www.webdeveloper.com/forum/showthread.php?t=133979&page=1&pp=15[/URL]

It showes how to create and append som input fields. All you need to do is to change it to create select (with options) -element instead.

If this don't help you, write here again and explain more thoroughly what you're trying to do ?.
Copy linkTweet thisAlerts:
@mattasticauthorJan 09.2007 — Thanks again for your reply

That link is a bit complicated for me, I dont really understand it.

I have a form:

http://www.halesowen.ac.uk/jstest.cfm

and i would like to add equipment by clicking the add button on the left hand side of the page.

Can you help?

Thankyou
Copy linkTweet thisAlerts:
@Dr_FlinkJan 09.2007 — Don't realy understand what you're doing here. I'm clicking the "Insert slot" button, and it seems to work fine?
Copy linkTweet thisAlerts:
@mattasticauthorJan 09.2007 — its the add button on the right, sorry my mistake. I have no script for it though, I have no idea where to start.

I need to add equipment select lists by clicking the add button.

Thanks again
Copy linkTweet thisAlerts:
@Dr_FlinkJan 09.2007 — Ok, but I still don't follow. Let's say I choose an equipment and a quantity. What do you want to happen and where should it happen.
Copy linkTweet thisAlerts:
@mattasticauthorJan 09.2007 — OK sorry for my poor explanation. When you click 'add' i want another select list and quantity list to appear underneath the current one, so users can add numerous pieces of equipment. So they can book multiple items of equipment per slot.

Is that ok?

Thanks again
Copy linkTweet thisAlerts:
@Dr_FlinkJan 09.2007 — Ok, well you can do it in different ways. You should create the select menus on-the-fly. As I did in the thread I mentioned, or you could clone the container div with all its children and then rename the id (last letter incremented with 1 as a suggestion).
Copy linkTweet thisAlerts:
@mattasticauthorJan 09.2007 — great thanks, can you tell me how I clone the container div please?

Thankyou
×

Success!

Help @mattastic spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...