Scope namespaces to a specific name or plugin

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. /*
  2. Why namespace? Namespacing ensures that your
  3. variables don't conflict with any others which
  4. happen to have the same name. This is important
  5. if you want to avoid your code breaking when
  6. other files or plugins are included in your
  7. page's architecture. See below for an example of
  8. namespacing data.
  9. */
  11. $("div").data("events.plugin",
  12. {
  13. //your data here
  14. });

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.