本文实例为大家分享了jQuery实现简单评论功能的具体代码,供大家参考,具体内容如下
例子:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<!DOCTYPE html> < html > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> < title ></ title > < meta charset = "utf-8" /> < style type = "text/css" > #tab { border-right:1px solid #000000; border-bottom:1px solid #000000; width:200px; } #tab td{ border-left:1px solid #000000; border-top:1px solid #000000; } </ style > < script src = "../scripts/jquery-1.3.1.js" ></ script > < script > $(function () { $("#Button1").click(function () { //获取昵称 var name = $("#name").val(); //获取内容 var next = $("#next").val(); //添加 var ul_li = $(" < tr >< td >" + name + "</ td >< td >" + next + "</ td >"); var b = $("#tab"); b.append(ul_li); }); }); </ script > </ head > < body > < div > < table id = "tab" > < tr >< td >昵称</ td >< td >内容</ td > </ table > 昵称:< input id = "name" type = "text" /> 内容:< input id = "next" type = "text" /> < input id = "Button1" type = "button" value = "评论" /> </ div > </ body > </ html > |
效果:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/hemingyang97/article/details/80903088