{"id":1366,"date":"2022-08-30T15:15:56","date_gmt":"2022-08-30T15:15:56","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/13\/parsley-js-adding-span-before-error-message-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:15:56","modified_gmt":"2022-08-30T15:15:56","slug":"parsley-js-adding-span-before-error-message-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/parsley-js-adding-span-before-error-message-collection-of-common-programming-errors\/","title":{"rendered":"Parsley.js adding span before error message-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;d like to add span element before every messages is Parsley.js. This code&#8217;s working for prepared messages but not for custom messages.<\/p>\n<pre><code>    \/**\n    * Add \/ override error message\n    *\n    * @method addMessage\n    * @param {String} name Message name. Will automatically be binded to validator with same name\n    * @param {String} message Message\n    *\/\n    , addMessage: function ( key, message, type ) {\n\n      if ( 'undefined' !== typeof type &amp;&amp; true === type ) {\n        this.messages.type[ key ] = '' + message;\n        return;\n      }\n\n      \/\/ custom types messages are a bit tricky cuz' nested ;)\n      if ( 'type' === key ) {\n        for ( var i in message ) {\n          this.messages.type[ i ] = '' + message[ i ];\n        }\n\n        return;\n      }\n\n      this.messages[ key ] = '' + message;\n    }\n  };\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-13 09:50:12. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;d like to add span element before every messages is Parsley.js. This code&#8217;s working for prepared messages but not for custom messages. \/** * Add \/ override error message * * @method addMessage * @param {String} name Message name. Will automatically be binded to validator with same name * @param {String} message Message *\/ , [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1366","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1366"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1366\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}