I’m working on a jQuery project right now that will essentially dump a bunch of HTML on someone’s page when they incorporate our plugin.
This little widget has a decent amount of HTML.
So, is it best to put 150+ lines of HTML inside the plugin itself? I had a thought that was basically “have the plugin use jQuery’s ajax to pull a chunk of HTML from our server, and then use THAT instead of putting a bunch of stuff inside the JS file”, but not sure if that’s the best approach, in terms of the overall jQuery plugin methodology.
If you need flexibility in your plugin, you should pull the HTML separately, as this will allow you to easily change out the text, and use the same plugin for different purposes.
If the text will never change, or changes infrequently, you might as well leave it in the plugin.