Fw: [問題] jquery如何自定function傳入物件

作者: JGC18 (JGC)   2013-12-02 22:32:51
※ [本文轉錄自 Web_Design 看板 #1Id98JkA ]
作者: 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
不知道該如何下手,請指點我一點方向
感謝^^
作者: grence (dalalida)   2013-02-04 00:40:00
我很好奇為什麼不能跑,結果你只是打錯字 = =a檢查你的 function name,你的想法沒有問題

Links booklink

Contact Us: admin [ a t ] ucptt.com