/    Sign up×
Community /Pin to ProfileBookmark

Relation between SPAN and FORM elements

I have got a html document with form and span element as mentioned below. I wanted to know is there a parent and child relation between the “form” ,”span” and “form elements” in JavaScript. For example using form id can I able to access all the span ids inside the FORM and similarly using form id and span id can I able to access the elements inside that specific FORM and SPAN using javascript.

<form id=”firstform”>

<span id=”first” name=”something” >
<input name=”fname” type=”text”>
<input name=”lname” type=”text”>
</span>

<span id=”second” name=”something” >
<input name=”fname1″ type=”text”>
<input name=”lname1″ type=”text”>
</span>

<span id=”third” name=”something” >
<input name=”fname2″ type=”text”>
<input name=”lname2″ type=”text”>
</span>

</form>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63Mar 24.2003 — If you want to know that span is a form element then no its not .

if I am completely out of the influence of saturday night then here is the list of form elements

form.textarea

form.text

form.fileupload

form.password

form.hidden

form.submit

form.reset

form.radio

form.checkbox

form.button

form.select

form.select.option

span is a w3c standard element just like id

Cheers

Khalid
Copy linkTweet thisAlerts:
@nkaisareMar 24.2003 — Also note that span is not a block-level element, so your usage is incorrect. use <div id="first" style="display:inline"> instead.

Since each form element has a unique name, you should not have any problems with javascript. If you are trying to turn display on or off of an entire span based on user input using javascript, you can always turn its visibility on or off. Dont know if this is what you are trying to do.

Khalid, <span> is an HTML element, id is an attribute ?
Copy linkTweet thisAlerts:
@khalidali63Mar 24.2003 — your are right, I guess I just overlooked while writing it.id is attribute and span is an w3c standard element.

Khalid
×

Success!

Help @raghu 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.23,
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,
)...