Help - Search - Members - Calendar
Full Version: JavaScript Problems
Invision Power Services > Community Forums > Community Web Design and Coding
Kenny Pollock
I'm using
CODE
print "\t\t\t<option value=\"".$entry."\" label=\"".str_replace("\t\t", "", $tree['HOUSTONCAT']['CATNAME']['VALUE'])."\">".$tree['HOUSTONCAT']['CATDESC']['VALUE'] ."</option>\n";

I know how to get value of an option, and label, but what's in between the option tags? I thought it was .text but that shows the value too.

Thanks!
.Jack
HTML
<option value="HIDDENVALUE">SHOWNTEXT</option>
Kenny Pollock
Uh? What is that for? I asked what is it called in JS between the option tags?

EX:
LABEL: this.options[this.selectedIndex].label
VALUE: this.options[this.selectedIndex].value
(and also this.options[this.selectedIndex].text I've learned)
<OPTION>this</OPTION>: ??
Stephen
it should be .text and .value is the value="" attribute maybe it doesn't work because you have the label attribute? I just tested the label attribute in the major 3 browsers and none of them use it
Kenny Pollock
That's the thing, I want to have 3 attributes to it.
Value is set to the filename of the file it's showing, label is set to what I want to show, and what's in between the two tags is the description of the file, all three which I need.
Stephen
Well that seems weird but anyway, what error does the JS give you?
Kenny Pollock
No error, but .text shows the value and not the text inbetween. I want it to show the text in between.
Nash12
I set up an example, I hope that is what you mean: http://www.nashweb.de/test/select.html

Select an option of the select box and an alert will popup containing the text between selected the option tag. I just tested in in Firefox; itīs done via:

CODE
this.options[this.selectedIndex].firstChild.nodeValue
_
.innerHTML? unsure.gif
Kenny Pollock
DUDE! Thanks Veracon (as usual).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.