JQuery 获得div标签内的值 如 <div id="aaa">123</div> 这样的DIV 我想在jquery 里面获取到123 ,求教怎么做。? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 有个新问题。 现在获得这个123了。 我就是里面 我想给这个123 做+1 操作。然后div标签里面显示变成124.怎么做? - - 有个新问题。 现在获得这个123了。 我在js里面 我想给这个123 做+1 操作。然后div标签里面显示变成124.怎么做? - - $('#aaa').html(parseInt($('#aaa').html())+1) 页面没能 变成124 ,我吧你给的 东西alert出来 是[object Object]; 我吧核心代码发一下吧<script language="javascript"> function fun_vote(){ $('#aaa').html(parseInt($('#aaa').html())+1) }</script><div id="aaa"> 123 </div><input type="button" onclick="fun_vote()" value="投票"/> $("#aaa").html(parseInt($("#aaa").html()) + 1); //这样写肯定没问题没有变成124说明你写的代码有问题,整理一下发上来看看。 没问题的,估计是别的代码有问题,错误控制台下看看浏览器报什么错误。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script><script type="text/javascript">function fun_vote() { $('#aaa').html(parseInt($('#aaa').html()) + 1);}</script></head><body><div id="aaa"> 123 </div><input type="button" onclick="fun_vote()" value="投票" /></body></html> function(e)中的参数“e”是什么意思 点击一个<a>链接,实现文件上传 一个正则表达式入门的问题 传参问题 (this) 弹出一个窗口(页面)问题。 UBB编辑器出现问题 怎么样使用javascript脚本感知网页已经拉到的最底端呢? 又是一个关于showModalDialog的问题~! 错误提示:缺少对象,请大虾帮忙看一下 关于节日的问题,请教javascript高手???? map类型 如何返回字符串呢 请教,如何通过代码调用快车下载。js
function fun_vote(){
$('#aaa').html(parseInt($('#aaa').html())+1)
}</script><div id="aaa"> 123 </div>
<input type="button" onclick="fun_vote()" value="投票"/>
没问题的,估计是别的代码有问题,错误控制台下看看浏览器报什么错误。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function fun_vote() {
$('#aaa').html(parseInt($('#aaa').html()) + 1);
}
</script>
</head><body>
<div id="aaa"> 123 </div>
<input type="button" onclick="fun_vote()" value="投票" />
</body>
</html>