How to return a customized/created selector in jquery plugin

I am learning how to create plugin and have problem in how to create my own customized selector. If I have a table with nth row and nth column below ........ . . . ........
and I would like to create a plugin that has a selector that points to a specified row and column This might how the plugin function looks like $.fn.Cell = function(row,col){ //select the cell here ... assuming the target element is a table above // this could somehow written below var mycell = $(this).children().find('tr:eq(' + row + ')').children().find('td:eq(' + col + ')'); // return the selector here }; Then, I should have in the application code something like this: $("#myTable").Cell(2,3).text("Wow"); // this writes a text to row 2, col 3. Can you help fill in the missing code? I tried looking on the available plugins but never found features like this. I prefer to know how this works than knowing names and links of existing plugins. My goal is to learn the process of making plugins and to master jquery and javascript as well.

以上就是How to return a customized/created selector in jquery plugin的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准