• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Create a Table as a jQuery plugin

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to know how can I create a HTML table in JQueryP code dinamicaly.

I would like to create a simple table like:

<table bgcolor=white width="245">
<tr>
<td>
<font color=darkblue size=3>Category 1</font>
<br>
<font color=#1dc4ff size=2><a href="">Element 1</a></font>
<br>
<font color=#1dc4ff size=2><a href="">Element 2</a></font>
</td>
</tr>
</table>



In something that I can code in my .jsp file. Something like:


(function( $ ) {


$.fn.MyTable = function(options) {

});
};


Thank you so much
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP or jQuery? You ask about JSP and then show code that creates a jQuery plugin.

Also, attributes such as bgcolor and tags such as <font> are deprecated and should not be used.
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I was refering to JQuery.

Thanks

I'm trying to be able to create a Table dynamically since I'm going to have it in many different sites I don't want to change the table in all the sites each time I need to modify the table.

I tried the following and I don't know why is not working:


Calling it:

Thanks again
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please read ItDoesntWorkIsUseless and tell us in detail what's not working.

Also, have you launched the JavaScript debugger and tried stepping through the code to see where it's going awry?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the purpose of calling the plugin on "#sidebar-lef" if you've hard-coded the table parent as "#output"?

Also, the table element is not self-closing, specify one of $('<table>') or $('<table></table>').
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the jsfiddle of what I'm trying


http://jsfiddle.net/samuvk/fbvXn/

Thanks
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solved.

Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic