title: My code to make the first name's first letter capital in jsp using javascript is not working
body: <p>Here is my jsp code please go through: </p>
  
  <pre><code>&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  function capitalize(s)
  {
      return s[0].toUpperCase() + s.slice(1);
  }
  &lt;/script&gt;
  
  &lt;body bgcolor="#D0D0D0" onLoad="addList()"&gt;
  &lt;h1&gt;Welcome to registration page&lt;/h1&gt; &lt;br/&gt; &lt;br/&gt;
  &lt;h3&gt;Enter your personal details here&lt;/h3&gt;
  &lt;form name="Register" action="RegisterServlet" method="post" onSubmit="return validate()"&gt;
  &lt;table&gt;
  &lt;tr&gt;
  &lt;td&gt;First Name* : &lt;/td&gt;
  &lt;td&gt;&lt;input type="text" name="txtFname" id="fname" maxlength="30" onKeyup="capitalize(txtFname)"/&gt;
  &lt;span style="padding-left:100px;" id="errorFirstNameMissing" style="visibility:hidden;"&gt;&lt;font color="red"&gt;*Please provide your first name.&lt;/font&gt;&lt;/span&gt;
  &lt;span style="padding-left:100px;" id="errorFirstNameInValid" style="visibility:hidden;"&gt;&lt;font color="red"&gt;*Please provide a valid first name.&lt;/font&gt;&lt;/span&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  </code></pre>
  
  <ol>
  <li><p>Capitalising the first letter of the firstname is not happening</p>
  
  <p><strong>2.And i have another issue that the error message in the span id field i.e.*Please provide your first name will be displayed on the jsp page when the field is null and when the field is not null but it does not match with the format then it will be replaced by *Please provide a valid first name. I want the replacement to happen in the same line and at the same distance from the input field but now the latter is being displayed in a new line. So please some one help me to fix these two things</strong></p></li>
  </ol>