作者JGC18 (JGC)
看板Web_Design
标题[问题] jquery如何自定function传入物件
时间Mon Dec 2 21:58:40 2013
大家好
最近在摸索jquery
由於想要把一些功能独立出来写成function
我在
http://www.darkthread.net/MiniJQueryLab/
想要测试一下,底下这段错误程式码
[html]
<table border="1">
<tr>
<td id="td1">1221</td>
<tr>
</table>
[script]
function showMesg(td)//我知道不能这样写
{
alert(td.text());
}
$(document).ready(function() {
var tmpTd=$("#td1");
alert(tmpTd.text());//show 1221
showMsg(tmpTd);
});
希望把某一个元素select出来後,丢给一个变数
再把这一个变数丢进自定function
再call自定function
不知道该如何下手,请指点我一点方向
感谢^^
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 175.182.168.174
1F:推 kyork:检查一下function name 12/02 23:31
2F:推 tomin:可以动喔 只要改一下naming: showMesg showMsg 12/02 23:48