I have a select box, I want to drop down the text to show one thing and when it is selected in the box If it goes, then this one else does not show my value tag either I would appreciate all the help. For example:
For example:
Select the selection box when it is not left below, should say and value is selected:
T2 <
T1: (includes T1A, T1B, and T1C): Tumor 2 cm (3 inches) 4 inches) or less.
T2: The tumor is more than 2 cm but not more than 5 centimeters (2 inches).
T3: The tumor is more than 5 cm.
Option labels are not fully supported (even if they think they are :)) To trick and work it , Add a first blank Value for jQuery In view of such a HTML : & lt; Options & gt;
We will use jQuery
& lt; Options & gt; Tags
$ .fn SelectLabelize = function () {var v = $ (': selected', this) .val (); $ ('Option', this) .eq (0) .text (v) .val (v) .prop ('selected', true); }; $ ('Select'). Each (function () {$ (this) .selectLabelize ();}); $ ('Choose'). ('Change', function () {$ (this) .selectLabelize ();});
& lt; Select & gt; & Lt; Options & gt; & Lt; / Options & gt; & Lt; Optgroup label = "T1" & gt; & Lt; Option value = "T1a" selected & gt; A - Tumor is 2 centimeters (3/4 inches) or less. & Lt; / Option & gt; & Lt; Option value = "t 1b" & gt; B - Tumors are 2 cm (3/4 inches) or less. & Lt; / Option & gt; & Lt; Option value = "t 1c" & gt; C - Tumors are less than 2 cm (3/4 inches) or less. & Lt; / Option & gt; & Lt; / Optgroup & gt; & Lt; Optgroup label = "T2" & gt; & Lt; Option value = "T2" & gt; The tumor is more than 2 cm but not more than 5 cm (2 inches). & Lt; / Option & gt; & Lt; / Optgroup & gt; & Lt; Optgroup label = "T3" & gt; & Lt; Option value = "T3" & gt; The tumor is more than 5 cm & Lt; / Option & gt; & Lt; / Optgroup & gt; & Lt; / Select & gt; Pure JS must be used:
No comments:
Post a Comment