Skip to main content

Timeline for jQuery plugIn to manage forms

Current License: CC BY-SA 3.0

13 events
when toggle format what by license comment
Nov 30, 2015 at 5:55 history edited Jamal CC BY-SA 3.0
deleted 110 characters in body
Nov 30, 2015 at 5:54 history edited 200_success CC BY-SA 3.0
edited tags; edited title
Oct 12, 2012 at 11:13 comment added Waqas Ali Beetroot, if am using this plugin name ' W.jQuery.FieldEvents ' then it contains dots (.), i thought it will create problems in event binding code i.e : edit_button.on('click.'+name_space,function(){//code});
Oct 11, 2012 at 19:48 comment added Beetroot-Beetroot Waqasalieee, you don't need name_space as well as plugin_name. Simply use the plugin_name as the namespace name, and start the supervisor with $.fn[plugin_name] = function(method) {. @Flambino, with this pattern, you can only store whole-plugin stuff in the closure; no closure within the pattern is scoped to be element-specific so data must be stored in the DOM with .data().
Oct 11, 2012 at 16:10 comment added Flambino You could store everything in a closure, I suppose, but I see no reason to not use .data(). Seems pretty straightforward to me (disclaimer: I've never had to make a jQuery plugin, so perhaps someone with more experience has a different opinion). As for the double events, I'd suggest you check for existing data on the elements. If it's there, it's been set up before, and you can merge the existing settings and the passed-in options, instead of merging with the default options. Then calling it twice on the same element won't double the event, but will update the settings.
Oct 11, 2012 at 15:04 comment added Waqas Ali What about data management, am i doing it correctly? is this good approach to save data for each element in its jQuery data attribute. Is there a way to store elements data in a single datastore? I have also noticed that if i call this plugin twice on an element it will double map the events. i.e showing two error messages instead of one. i want to avoid it, is there any way out?
Oct 11, 2012 at 6:57 answer added Mathankumar timeline score: 3
Oct 11, 2012 at 3:06 comment added Flambino It's always useful to run the code through jslint or jshint. For instance, both caught that dialog_id is not defined anywhere but used in show_error(). You also have an implicit global (data in destroy()) which neither jshint or jslint caught (I just spotted it by chance).
Oct 11, 2012 at 3:01 history tweeted twitter.com/#!/StackCodeReview/status/256228094090817536
S Oct 10, 2012 at 13:21 history suggested Zuul CC BY-SA 3.0
Rephrased the title for clarity. Better content readability. Added relevant tags.
Oct 10, 2012 at 12:47 review Suggested edits
S Oct 10, 2012 at 13:21
Oct 10, 2012 at 12:06 history migrated from stackoverflow.com (revisions)
Oct 10, 2012 at 9:42 history asked Waqas Ali CC BY-SA 3.0