javascript - Live Validation change output location -
i'm using live validation javascript library , i'm wondering how can use place feedback @ bottom of page.
for instance, user input "asdf.com" in <input type="text" id="subdomain-name" name="subdomain-name">
and want live-validation respond "a sub-domain should not include periods." @ bottom of page, because otherwise mess text located after box: http://puu.sh/3ixdc.jpg.
i tried create css div , reference span in
createmessagespan: function(){ var span = document.createelement('span'); var textnode = document.createtextnode(this.message); span.appendchild(textnode); return span; },
but did not work
you can use jquery , html() function. know isn't live validation work.
the html
<html> <head> <script src="jquery.js"></script> </head> <body> other html here <div id="suggestion"></div> </body> </html>
the javascript
if(the code determines if message necessary){ $("#suggestion").html("a sub-domain should not include periods."); }
Comments
Post a Comment