Page 1 of 1

[RESOLVED] doubt

Posted: Wed Sep 05, 2007 7:28 am
by vinoth
shall we assign numbers as textbox ID ?
or any rules to assign ID to text box ?

Posted: Wed Sep 05, 2007 8:06 am
by superdezign
IDs are meant to be either descriptive or as a way of differentiating between elements. There are no "rules" really, only that they are manageable.

When it comes to multiple elements of the same type, if they are related, you can always used getElementsByTagName and filter them by className and such.

Posted: Wed Sep 05, 2007 8:11 am
by vinoth
ok fine If we use Numbers also It was worked but I don't know any rules for that or not

thats only I asked

Thanks for your Suggestion

Posted: Wed Sep 05, 2007 8:19 am
by superdezign
vinoth wrote:ok fine If we use Numbers also It was worked but I don't know any rules for that or not
You mean using *only* numbers? I'm fairly sure it is against the CSS standards to start the ID with a number.

Posted: Thu Sep 06, 2007 4:34 am
by vinoth
ya I assign the id as numbers alone its working

because I print 5 text box dy using for loop

Code: Select all

(for $i=0;$i<5;$i++)
{
echo "<input type='text' id='$i'>
}