看板 [ Ajax ]
討論串[問題] jQuery如何取id尾數當作顏色代碼?
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者ateclean (阿吃)時間13年前 (2010/10/24 00:18), 編輯資訊
1
0
0
內容預覽:
想請教板上的前輩們. 最近在把玩wordpress. 遇到一個小問題. 如何用jQuery取得元素的id後幾碼,然後套用到css中呢?. Html結構:. <div id="post-159" class="post">. <h3 class="story"></h3>. <p>...</p>. <
(還有194個字)

推噓1(1推 0噓 3→)留言4則,0人參與, 最新作者ybite (小犬)時間13年前 (2010/10/24 00:41), 編輯資訊
0
0
0
內容預覽:
My solution, 也許不夠好:. $('div.post').each(function(index) {. var id = $(this).attr('id');. var colorValue = '#A' + id.substr(id.length - 2, 2);. $(this)
(還有417個字)
首頁
上一頁
1
下一頁
尾頁