Search code examples
javascripthtmlcsslivevalidation

Live Validation change output location


I'm using the Live Validation Javascript library and I'm wondering how I can use it to place the feedback at the bottom of the page.

For instance, a user would input "asdf.com" in <input type="text" id="subdomain-name" name="subdomain-name">

And I would want Live-Validation to respond back "A sub-domain should not include periods." but at the bottom of the page, because otherwise it would mess up the text that is located after the box: http://puu.sh/3IxDc.jpg.

I tried to create a CSS div and then reference that as span in

createMessageSpan: function(){
    var span = document.createElement('span');
    var textNode = document.createTextNode(this.message);
    span.appendChild(textNode);
    return span;
},

but that did not work


Solution

  • By using the

    insertAfterWhatNode

    Property I was able to do it, example:

    var port = new LiveValidation("subdomain-port", {validMessage: "Port is valid", insertAfterWhatNode: "error"});

    Where "error" is the element id of where you want it after.