this question may sound stupid, but no one has ever taught me this. I have an HTML input for a password field, and you can only log on with one specific password with JS. Could someone please give me a syntax on assigning a variable to document.getElementById(""); syntax or a different syntax? Thanks.

  • I think you would be better asking these types of questions on stackoverflow. This site is for more subjective questions about programming, not specific language features. – GrandmasterB Sep 15 '12 at 17:18

I guess you are trying to use password in your page. If the purpose of registration is to confirm that the person exists and has supplied a valid email address then at the first instance you should email them a random password rather than having them choose their own and use it immediately.

Here is a good article that walks you through JavaScript: Password Validation using regular expressions and HTML5.

In addition you may get a wealth of information about HTML DOM Password Object here.

  • I just did! I recently gained that advantage! – Coding Seahawks Sep 15 '12 at 16:45
  • Sure, what were they titled? – Coding Seahawks Sep 15 '12 at 16:54
  • @CodingSeahawks, thx, they all titled as HTML5 questions that you have asked today. look at your Questions list - programmers.stackexchange.com/users/64280/coding-seahawks – Yusubov Sep 15 '12 at 17:01
  • I just did that. But you did not answer 1 html5 question. :) – Coding Seahawks Sep 15 '12 at 17:04
  • well that question is closed. i am not able to put any answer there. what mobile phone r u using? – Yusubov Sep 15 '12 at 17:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.