jQuery Validation - how to separate errors within the errorPlacement callback? -
errorplacement: function (error, element) { $('#div').append(error.html()); } i want append list of errors within div in webpage upon calling function. right calling error.html() giving me whole list of errors listed within messages function concatenated together.
ex in div:
title requirednumber of words must between 50 , 65picture required
i can provide more code if needed.
errorplacement option/function used place each individual error next each individual input field. not option use if want list of errors.
if want create list of error messages, use the showerrors option. refer the documentation example usage...
showerrors: function(errormap, errorlist) { $("#summary").html("your form contains " + this.numberofinvalids() + " errors, see details below."); this.defaultshowerrors(); } generic demo: http://jsfiddle.net/0k0vl1b0/
if want suppress messages next each field, comment out this.defaultshowerrors() line , write code extract messages provided errorlist argument.
demo 2: http://jsfiddle.net/0k0vl1b0/1/
Comments
Post a Comment