This article mainly introduces how to achieve click label text in js, text appears in the text box, interested friends can refer to js to achieve click label text, text appears in the text box, the functions of the following two methods are slightly different. In general, method 1 is more powerful.
Method 1: clicking any label at Will will appear in the text box. How to click the label for the second time will the corresponding text disappear in the text box.
Municipal,
Provincial,
National script var x = ["municipal", "Provincial", "national"]; var y = []; function $ (id) {return document. getElementById (id)}; for (var I = 0, m = x. length; I
= 0) {for (var r in y) {if (y [r] = x [I]) {y. splice (r, 1) }}} else {y. push (x [I])} $ ("I "). value = y. join ("") ;}}) (I)} script
:
Method 2: When you click the "" tag, the tag appears in the text box, and then click the SQL tag, the "SQL" label will replace the "script home" label in the text box.
JS special effect C ++ SQL script home