开发者

jquery plugin return value

Im building a Jquery form validation plugin. my concern is that my plugin does not return the object for chaining purpose. but rather it returns an array. the array is one of the two

  1. array1 contains all the required field names which are not filled in. but if all the required fields are filled in then this is ignored.
  2. array开发者_如何学编程2 will be returned only if value inside form input element is not matching(regex). other wise a true is returned if all the required fields are filled in and the data are correct in the form input elements and the form will be submitted.

So any suggestion please, if you think this is bad, because the plugin should return the object for chaining purpose. or if you think im doing this its all ok. thanks for your help in advance


Make your plugin require a callback as a parameter. Instead of returning your array, you can pass it to the callback. This will get the data out, but let you still return the object as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜