1 | <html> |
---|
2 | <head> |
---|
3 | <script type="text/javascript" src="jquery-1.3.2.js"></script> |
---|
4 | <script type="text/javascript"> |
---|
5 | function hide_it() { |
---|
6 | $("input[type='text']").hide() |
---|
7 | } |
---|
8 | function show_it() { |
---|
9 | $("input[type='text']").show() |
---|
10 | |
---|
11 | } |
---|
12 | |
---|
13 | $(document).ready(function() { |
---|
14 | |
---|
15 | var input1 = document.createElement("input"); |
---|
16 | input1.type = "text"; |
---|
17 | input1.name = "name1"; |
---|
18 | input1.value = "value1"; |
---|
19 | $("#id1").after( "test1" ); |
---|
20 | $("#id1").after( input1 ); |
---|
21 | $(input1).hide(); |
---|
22 | $(input1).show(); |
---|
23 | |
---|
24 | var input2 = document.createElement("input"); |
---|
25 | input2.type = "text"; |
---|
26 | input2.name = "name2"; |
---|
27 | input2.value = "value2"; |
---|
28 | $("#id2").after( "test2" ); |
---|
29 | $(input2).hide(); |
---|
30 | $("#id2").after( input2 ); |
---|
31 | $(input2).show(); |
---|
32 | |
---|
33 | }); |
---|
34 | |
---|
35 | </script> |
---|
36 | </head> |
---|
37 | <body> |
---|
38 | <h1>Hide/Show Demonstration</h1> |
---|
39 | <h2>add element</h2> |
---|
40 | <p id="id1"></p> |
---|
41 | <h2>hide, add, show element</h2> |
---|
42 | <p id="id2"></p> |
---|
43 | <p> |
---|
44 | <b>Bug:</b> |
---|
45 | This input element has <b><tt>display:block;</tt></b> set. |
---|
46 | </body> |
---|
47 | </html> |
---|