[問題] jquery如何自定function傳入物件
大家好
最近在摸索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
推
12/02 23:31, , 1F
12/02 23:31, 1F
推
12/02 23:48, , 2F
12/02 23:48, 2F