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