for loop alphabet javascript

Get all alphabet in javascript

Some time you need all aplhabet by a for loop. It is very easy in JavaScript. In below exapmle I have created all option of a dropdown by a for loop.

CODE
<!DOCTYPE html>
<html>
<head>
  <title>Get all alphabet in javascrip</title>
  <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
  <script type="text/javascript">
    $(function () {
      for (var i = 65; i <= 90; i++) {
        $('.ddlAplhabet').append('<option value="' + String.fromCharCode(i).toLowerCase() + '">' + String.fromCharCode(i).toUpperCase() + '</option>');
      }

    });
  </script>
</head>
<body>
  <select class="ddlAplhabet">
    <option>Select aplhabet</option>
  </select>
</body>
</html>
DISPLAY

2 comments :

  1. very nice article you shared.
    if you want to know the technologies updates,visit below site.
    http://www.dotnetbasic.com

    ReplyDelete
  2. Get this quick reference information to discover your surface finish choices across our six 3D printing applied sciences. Use of this website constitutes acceptance of our User Agreement and Privacy Policy and Cookie Statement and Your California Privacy Rights. PA might earn a portion of sales from merchandise would possibly be} bought by way of our website as part of of} our Affiliate Partnerships with retailers. The material on this website most likely not|will not be} reproduced, Bike Helmets For Kids distributed, transmitted, cached or in any other case used, besides with the prior written permission of PA Ad Choices.

    ReplyDelete