Build a Javascript International Telephone Country Dial Codes Dropdown with Flags Input in HTML5 and CSS3 Full Project For Beginners CSS3

Build a Javascript International Telephone Country Dial Codes Dropdown with Flags Input in HTML5 and CSS3 Full Project For Beginners CSS3

 

Welcome folks today in this blog post we will be building a javascript international telephone country dial codes dropdown with flags input in html5 and css3. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to make an index.html file and copy paste the following code

 

index.html

 

<div class="wrapper">
<dl id="country-select" class="dropdown">
  <dt><a href="javascript:void(0);"><span><span style="background-position:0px -1694px"></span><span>India</span><span>+91</span></span></a></dt>
  <dd>
    <ul style="display: none;">
      <li><a cunt_code="+91" href="javascript:void(0);"><span style="background-position:0px -1694px"></span><span>India</span><span>+91</span></a></li>
      <li><a cunt_code="" href="javascript:void(0);"><span style="background-position:0px -1694px"></span><span>India-Tollfree</span><span></span></a></li>
      <li><a cunt_code="+1" href="javascript:void(0);"><span style="background-position:0px -44px"></span><span>United States</span><span>+1</span></a></li>
      <li><a cunt_code="+93" href="javascript:void(0);"><span style="background-position:0px -2311px"></span><span>Afghanistan</span><span>+93</span></a></li>
      <li><a cunt_code="+355" href="javascript:void(0);"><span style="background-position:0px -1034px"></span><span>Albania</span><span>+355</span></a></li>
      <li><a cunt_code="+213" href="javascript:void(0);"><span style="background-position:0px -528px"></span><span>Algeria</span><span>+213</span></a></li>
      <li><a cunt_code="+1684" href="javascript:void(0);"><span style="background-position:0px -1562px"></span><span>American Samoa</span><span>+1684</span></a></li>
      <li><a cunt_code="+376" href="javascript:void(0);"><span style="background-position:0px -594px"></span><span>Andorra</span><span>+376</span></a></li>
      <li><a cunt_code="+244" href="javascript:void(0);"><span style="background-position:0px -1947px"></span><span>Angola</span><span>+244</span></a></li>
      <li><a cunt_code="+1264" href="javascript:void(0);"><span style="background-position:0px -1980px"></span><span>Anguilla</span><span>+1264</span></a></li>
      <li><a cunt_code="+1268" href="javascript:void(0);"><span style="background-position:0px -869px"></span><span>Antigua and Barbuda</span><span>+1268</span></a></li>
      <li><a cunt_code="+54" href="javascript:void(0);"><span style="background-position:0px -2377px"></span><span>Argentina</span><span>+54</span></a></li>
      <li><a cunt_code="+374" href="javascript:void(0);"><span style="background-position:0px -176px"></span><span>Armenia</span><span>+374</span></a></li>
      <li><a cunt_code="+297" href="javascript:void(0);"><span style="background-position:0px -792px"></span><span>Aruba</span><span>+297</span></a></li>
      <li><a cunt_code="+247" href="javascript:void(0);"><span style="background-position:0px -55px"></span><span>Ascension Island</span><span>+247</span></a></li>
      <li><a cunt_code="+61" href="javascript:void(0);"><span style="background-position:0px -1716px"></span><span>Australia</span><span>+61</span></a></li>
      <li><a cunt_code="+43" href="javascript:void(0);"><span style="background-position:0px -1331px"></span><span>Austria</span><span>+43</span></a></li>
      <li><a cunt_code="+994" href="javascript:void(0);"><span style="background-position:0px -1243px"></span><span>Azerbaijan</span><span>+994</span></a></li>
      <li><a cunt_code="+1242" href="javascript:void(0);"><span style="background-position:0px -363px"></span><span>Bahamas</span><span>+1242</span></a></li>
      <li><a cunt_code="+973" href="javascript:void(0);"><span style="background-position:0px -1496px"></span><span>Bahrain</span><span>+973</span></a></li>
      <li><a cunt_code="+880" href="javascript:void(0);"><span style="background-position:0px -1771px"></span><span>Bangladesh</span><span>+880</span></a></li>
      <li><a cunt_code="+1246" href="javascript:void(0);"><span style="background-position:0px -1573px"></span><span>Barbados</span><span>+1246</span></a></li>
      <li><a cunt_code="+375" href="javascript:void(0);"><span style="background-position:0px -1100px"></span><span>Belarus</span><span>+375</span></a></li>
      <li><a cunt_code="+32" href="javascript:void(0);"><span style="background-position:0px 0px"></span><span>Belgium</span><span>+32</span></a></li>
      <li><a cunt_code="+501" href="javascript:void(0);"><span style="background-position:0px -484px"></span><span>Belize</span><span>+501</span></a></li>
      <li><a cunt_code="+229" href="javascript:void(0);"><span style="background-position:0px -1298px"></span><span>Benin</span><span>+229</span></a></li>
      <li><a cunt_code="+1441" href="javascript:void(0);"><span style="background-position:0px -1914px"></span><span>Bermuda</span><span>+1441</span></a></li>
      <li><a cunt_code="+975" href="javascript:void(0);"><span style="background-position:0px -1848px"></span><span>Bhutan</span><span>+975</span></a></li>
      <li><a cunt_code="+591" href="javascript:void(0);"><span style="background-position:0px -1650px"></span><span>Bolivia</span><span>+591</span></a></li>
      <li><a cunt_code="+599" href="javascript:void(0);"><span style="background-position:0px -2719px"></span><span>Bonaire, Sint Eustatius</span><span>+599</span></a></li>
      <li><a cunt_code="+387" href="javascript:void(0);"><span style="background-position:0px -1584px"></span><span>Bosnia and Herzegovina</span><span>+387</span></a></li>
      <li><a cunt_code="+267" href="javascript:void(0);"><span style="background-position:0px -2707px"></span><span>Botswana</span><span>+267</span></a></li>
      <li><a cunt_code="+55" href="javascript:void(0);"><span style="background-position:0px -770px"></span><span>Brazil</span><span>+55</span></a></li>
      <li><a cunt_code="+673" href="javascript:void(0);"><span style="background-position:0px -1683px"></span><span>Brunei</span><span>+673</span></a></li>
      <li><a cunt_code="+359" href="javascript:void(0);"><span style="background-position:0px -2586px"></span><span>Bulgaria</span><span>+359</span></a></li>
      <li><a cunt_code="+226" href="javascript:void(0);"><span style="background-position:0px -726px"></span><span>Burkina Faso</span><span>+226</span></a></li>
      <li><a cunt_code="+257" href="javascript:void(0);"><span style="background-position:0px -1892px"></span><span>Burundi</span><span>+257</span></a></li>
      <li><a cunt_code="+855" href="javascript:void(0);"><span style="background-position:0px -242px"></span><span>Cambodia</span><span>+855</span></a></li>
      <li><a cunt_code="+237" href="javascript:void(0);"><span style="background-position:0px -2057px"></span><span>Cameroon</span><span>+237</span></a></li>
      <li><a cunt_code="+1" href="javascript:void(0);"><span style="background-position:0px -1375px"></span><span>Canada</span><span>+1</span></a></li>
      <li><a cunt_code="+238" href="javascript:void(0);"><span style="background-position:0px -2652px"></span><span>Cape Verde</span><span>+238</span></a></li>
      <li><a cunt_code="+1345" href="javascript:void(0);"><span style="background-position:0px -308px"></span><span>Cayman Islands</span><span>+1345</span></a></li>
      <li><a cunt_code="+236" href="javascript:void(0);"><span style="background-position:0px -1837px"></span><span>Central African Republic</span><span>+236</span></a></li>
      <li><a cunt_code="+235" href="javascript:void(0);"><span style="background-position:0px -814px"></span><span>Chad</span><span>+235</span></a></li>
      <li><a cunt_code="+56" href="javascript:void(0);"><span style="background-position:0px -1342px"></span><span>Chile</span><span>+56</span></a></li>
      <li><a cunt_code="+86" href="javascript:void(0);"><span style="background-position:0px -825px"></span><span>China</span><span>+86</span></a></li>
      <li><a cunt_code="+57" href="javascript:void(0);"><span style="background-position:0px -330px"></span><span>Colombia</span><span>+57</span></a></li>
      <li><a cunt_code="+269" href="javascript:void(0);"><span style="background-position:0px -1430px"></span><span>Comoros and Mayotte</span><span>+269</span></a></li>
      <li><a cunt_code="+242" href="javascript:void(0);"><span style="background-position:0px -1793px"></span><span>Congo</span><span>+242</span></a></li>
      <li><a cunt_code="+243" href="javascript:void(0);"><span style="background-position:0px -1518px"></span><span>Congo Dem Rep</span><span>+243</span></a></li>
      <li><a cunt_code="+682" href="javascript:void(0);"><span style="background-position:0px -2267px"></span><span>Cook Islands</span><span>+682</span></a></li>
      <li><a cunt_code="+506" href="javascript:void(0);"><span style="background-position:0px -2090px"></span><span>Costa Rica</span><span>+506</span></a></li>
      <li><a cunt_code="+225" href="javascript:void(0);"><span style="background-position:0px -1661px"></span><span>Cote d'Ivoire</span><span>+225</span></a></li>
      <li><a cunt_code="+385" href="javascript:void(0);"><span style="background-position:0px -902px"></span><span>Croatia</span><span>+385</span></a></li>
      <li><a cunt_code="+53" href="javascript:void(0);"><span style="background-position:0px -748px"></span><span>Cuba</span><span>+53</span></a></li>
      <li><a cunt_code="+599" href="javascript:void(0);"><span style="background-position:0px -2729px"></span><span>Curaçao</span><span>+599</span></a></li>
      <li><a cunt_code="+357" href="javascript:void(0);"><span style="background-position:0px -561px"></span><span>Cyprus</span><span>+357</span></a></li>
      <li><a cunt_code="+420" href="javascript:void(0);"><span style="background-position:0px -2256px"></span><span>Czech Republic</span><span>+420</span></a></li>
      <li><a cunt_code="+45" href="javascript:void(0);"><span style="background-position:0px -1386px"></span><span>Denmark</span><span>+45</span></a></li>
      <li><a cunt_code="+246" href="javascript:void(0);"><span style="background-position:0px -55px"></span><span>Diego Garcia</span><span>+246</span></a></li>
      <li><a cunt_code="+253" href="javascript:void(0);"><span style="background-position:0px -2101px"></span><span>Djibouti</span><span>+253</span></a></li>
      <li><a cunt_code="+1767" href="javascript:void(0);"><span style="background-position:0px -2432px"></span><span>Dominica</span><span>+1767</span></a></li>
      <li><a cunt_code="+1809" href="javascript:void(0);"><span style="background-position:0px -1529px"></span><span>Dominican Republic</span><span>+1809</span></a></li>
      <li><a cunt_code="+593" href="javascript:void(0);"><span style="background-position:0px -1188px"></span><span>Ecuador</span><span>+593</span></a></li>
      <li><a cunt_code="+20" href="javascript:void(0);"><span style="background-position:0px -2201px"></span><span>Egypt</span><span>+20</span></a></li>
      <li><a cunt_code="+503" href="javascript:void(0);"><span style="background-position:0px -1639px"></span><span>El Salvador</span><span>+503</span></a></li>
      <li><a cunt_code="+240" href="javascript:void(0);"><span style="background-position:0px -1507px"></span><span>Equatorial Guinea</span><span>+240</span></a></li>
      <li><a cunt_code="+291" href="javascript:void(0);"><span style="background-position:0px -715px"></span><span>Eritrea</span><span>+291</span></a></li>
      <li><a cunt_code="+372" href="javascript:void(0);"><span style="background-position:0px -2410px"></span><span>Estonia</span><span>+372</span></a></li>
      <li><a cunt_code="+251" href="javascript:void(0);"><span style="background-position:0px -2443px"></span><span>Ethiopia</span><span>+251</span></a></li>
      <li><a cunt_code="+500" href="javascript:void(0);"><span style="background-position:0px -2762px"></span><span>Falkland Islands</span><span>+500</span></a></li>
      <li><a cunt_code="+298" href="javascript:void(0);"><span style="background-position:0px -1111px"></span><span>Faroe Islands</span><span>+298</span></a></li>
      <li><a cunt_code="+679" href="javascript:void(0);"><span style="background-position:0px -1859px"></span><span>Fiji</span><span>+679</span></a></li>
      <li><a cunt_code="+358" href="javascript:void(0);"><span style="background-position:0px -1903px"></span><span>Finland</span><span>+358</span></a></li>
      <li><a cunt_code="+33" href="javascript:void(0);"><span style="background-position:0px -1012px"></span><span>France</span><span>+33</span></a></li>
      <li><a cunt_code="+594" href="javascript:void(0);"><span style="background-position:0px -2234px"></span><span>French Guiana</span><span>+594</span></a></li>
      <li><a cunt_code="+689" href="javascript:void(0);"><span style="background-position:0px -1705px"></span><span>French Polynesia</span><span>+689</span></a></li>
      <li><a cunt_code="+241" href="javascript:void(0);"><span style="background-position:0px -880px"></span><span>Gabon</span><span>+241</span></a></li>
      <li><a cunt_code="+220" href="javascript:void(0);"><span style="background-position:0px -627px"></span><span>Gambia</span><span>+220</span></a></li>
      <li><a cunt_code="+995" href="javascript:void(0);"><span style="background-position:0px -858px"></span><span>Georgia</span><span>+995</span></a></li>
      <li><a cunt_code="+49" href="javascript:void(0);"><span style="background-position:0px -2509px"></span><span>Germany</span><span>+49</span></a></li>
      <li><a cunt_code="+233" href="javascript:void(0);"><span style="background-position:0px -2112px"></span><span>Ghana</span><span>+233</span></a></li>
      <li><a cunt_code="+350" href="javascript:void(0);"><span style="background-position:0px -275px"></span><span>Gibraltar</span><span>+350</span></a></li>
      <li><a cunt_code="+30" href="javascript:void(0);"><span style="background-position:0px -165px"></span><span>Greece</span><span>+30</span></a></li>
      <li><a cunt_code="+299" href="javascript:void(0);"><span style="background-position:0px -1760px"></span><span>Greenland</span><span>+299</span></a></li>
      <li><a cunt_code="+1473" href="javascript:void(0);"><span style="background-position:0px -2399px"></span><span>Grenada</span><span>+1473</span></a></li>
      <li><a cunt_code="+590" href="javascript:void(0);"><span style="background-position:0px -407px"></span><span>Guadeloupe</span><span>+590</span></a></li>
      <li><a cunt_code="+1671" href="javascript:void(0);"><span style="background-position:0px -2366px"></span><span>Guam</span><span>+1671</span></a></li>
      <li><a cunt_code="+502" href="javascript:void(0);"><span style="background-position:0px -935px"></span><span>Guatemala</span><span>+502</span></a></li>
      <li><a cunt_code="+224" href="javascript:void(0);"><span style="background-position:0px -2575px"></span><span>Guinea</span><span>+224</span></a></li>
      <li><a cunt_code="+245" href="javascript:void(0);"><span style="background-position:0px -1925px"></span><span>Guinea Bissau</span><span>+245</span></a></li>
      <li><a cunt_code="+592" href="javascript:void(0);"><span style="background-position:0px -803px"></span><span>Guyana</span><span>+592</span></a></li>
      <li><a cunt_code="+509" href="javascript:void(0);"><span style="background-position:0px -319px"></span><span>Haiti</span><span>+509</span></a></li>
      <li><a cunt_code="+504" href="javascript:void(0);"><span style="background-position:0px -2156px"></span><span>Honduras</span><span>+504</span></a></li>
      <li><a cunt_code="+852" href="javascript:void(0);"><span style="background-position:0px -2696px"></span><span>Hong Kong</span><span>+852</span></a></li>
      <li><a cunt_code="+36" href="javascript:void(0);"><span style="background-position:0px -682px"></span><span>Hungary</span><span>+36</span></a></li>
      <li><a cunt_code="+354" href="javascript:void(0);"><span style="background-position:0px -1991px"></span><span>Iceland</span><span>+354</span></a></li>
      <li><a cunt_code="+91" href="javascript:void(0);"><span style="background-position:0px -1694px"></span><span>India</span><span>+91</span></a></li>
      <li><a cunt_code="+62" href="javascript:void(0);"><span style="background-position:0px -1958px"></span><span>Indonesia</span><span>+62</span></a></li>
      <li><a cunt_code="+98" href="javascript:void(0);"><span style="background-position:0px -2013px"></span><span>Iran</span><span>+98</span></a></li>
      <li><a cunt_code="+964" href="javascript:void(0);"><span style="background-position:0px -649px"></span><span>Iraq</span><span>+964</span></a></li>
      <li><a cunt_code="+353" href="javascript:void(0);"><span style="background-position:0px -1969px"></span><span>Ireland</span><span>+353</span></a></li>
      <li><a cunt_code="+972" href="javascript:void(0);"><span style="background-position:0px -341px"></span><span>Israel</span><span>+972</span></a></li>
      <li><a cunt_code="+39" href="javascript:void(0);"><span style="background-position:0px -143px"></span><span>Italy</span><span>+39</span></a></li>
      <li><a cunt_code="+1876" href="javascript:void(0);"><span style="background-position:0px -1727px"></span><span>Jamaica</span><span>+1876</span></a></li>
      <li><a cunt_code="+81" href="javascript:void(0);"><span style="background-position:0px -429px"></span><span>Japan</span><span>+81</span></a></li>
      <li><a cunt_code="+962" href="javascript:void(0);"><span style="background-position:0px -1463px"></span><span>Jordan</span><span>+962</span></a></li>
      <li><a cunt_code="+7" href="javascript:void(0);"><span style="background-position:0px -1210px"></span><span>Kazakhstan</span><span>+7</span></a></li>
      <li><a cunt_code="+254" href="javascript:void(0);"><span style="background-position:0px -2630px"></span><span>Kenya</span><span>+254</span></a></li>
      <li><a cunt_code="+686" href="javascript:void(0);"><span style="background-position:0px -374px"></span><span>Kiribati</span><span>+686</span></a></li>
      <li><a cunt_code="+850" href="javascript:void(0);"><span style="background-position:0px -1804px"></span><span>Korea, North</span><span>+850</span></a></li>
      <li><a cunt_code="+82" href="javascript:void(0);"><span style="background-position:0px -2245px"></span><span>Korea, South</span><span>+82</span></a></li>
      <li><a cunt_code="+965" href="javascript:void(0);"><span style="background-position:0px -2487px"></span><span>Kuwait</span><span>+965</span></a></li>
      <li><a cunt_code="+996" href="javascript:void(0);"><span style="background-position:0px -1617px"></span><span>Kyrgyzstan</span><span>+996</span></a></li>
      <li><a cunt_code="+856" href="javascript:void(0);"><span style="background-position:0px -451px"></span><span>Laos</span><span>+856</span></a></li>
      <li><a cunt_code="+371" href="javascript:void(0);"><span style="background-position:0px -1936px"></span><span>Latvia</span><span>+371</span></a></li>
      <li><a cunt_code="+961" href="javascript:void(0);"><span style="background-position:0px -1254px"></span><span>Lebanon</span><span>+961</span></a></li>
      <li><a cunt_code="+266" href="javascript:void(0);"><span style="background-position:0px -2190px"></span><span>Lesotho</span><span>+266</span></a></li>
      <li><a cunt_code="+231" href="javascript:void(0);"><span style="background-position:0px -2068px"></span><span>Liberia</span><span>+231</span></a></li>
      <li><a cunt_code="+218" href="javascript:void(0);"><span style="background-position:0px -132px"></span><span>Libya</span><span>+218</span></a></li>
      <li><a cunt_code="+423" href="javascript:void(0);"><span style="background-position:0px -979px"></span><span>Liechtenstein</span><span>+423</span></a></li>
      <li><a cunt_code="+370" href="javascript:void(0);"><span style="background-position:0px -1122px"></span><span>Lithuania</span><span>+370</span></a></li>
      <li><a cunt_code="+352" href="javascript:void(0);"><span style="background-position:0px -1474px"></span><span>Luxembourg</span><span>+352</span></a></li>
      <li><a cunt_code="+853" href="javascript:void(0);"><span style="background-position:0px -2597px"></span><span>Macao</span><span>+853</span></a></li>
      <li><a cunt_code="+389" href="javascript:void(0);"><span style="background-position:0px -1353px"></span><span>Macedonia</span><span>+389</span></a></li>
      <li><a cunt_code="+261" href="javascript:void(0);"><span style="background-position:0px -1287px"></span><span>Madagascar</span><span>+261</span></a></li>
      <li><a cunt_code="+265" href="javascript:void(0);"><span style="background-position:0px -2145px"></span><span>Malawi</span><span>+265</span></a></li>
      <li><a cunt_code="+60" href="javascript:void(0);"><span style="background-position:0px -1870px"></span><span>Malaysia</span><span>+60</span></a></li>
      <li><a cunt_code="+960" href="javascript:void(0);"><span style="background-position:0px -616px"></span><span>Maldives</span><span>+960</span></a></li>
      <li><a cunt_code="+223" href="javascript:void(0);"><span style="background-position:0px -2520px"></span><span>Mali</span><span>+223</span></a></li>
      <li><a cunt_code="+356" href="javascript:void(0);"><span style="background-position:0px -1551px"></span><span>Malta</span><span>+356</span></a></li>
      <li><a cunt_code="+692" href="javascript:void(0);"><span style="background-position:0px -1144px"></span><span>Marshall Islands</span><span>+692</span></a></li>
      <li><a cunt_code="+596" href="javascript:void(0);"><span style="background-position:0px -198px"></span><span>Martinique</span><span>+596</span></a></li>
      <li><a cunt_code="+222" href="javascript:void(0);"><span style="background-position:0px -253px"></span><span>Mauritania</span><span>+222</span></a></li>
      <li><a cunt_code="+230" href="javascript:void(0);"><span style="background-position:0px -2179px"></span><span>Mauritius</span><span>+230</span></a></li>
      <li><a cunt_code="+52" href="javascript:void(0);"><span style="background-position:0px -2024px"></span><span>Mexico</span><span>+52</span></a></li>
      <li><a cunt_code="+691" href="javascript:void(0);"><span style="background-position:0px -1738px"></span><span>Micronesia</span><span>+691</span></a></li>
      <li><a cunt_code="+373" href="javascript:void(0);"><span style="background-position:0px -2685px"></span><span>Moldova</span><span>+373</span></a></li>
      <li><a cunt_code="+377" href="javascript:void(0);"><span style="background-position:0px -913px"></span><span>Monaco</span><span>+377</span></a></li>
      <li><a cunt_code="+976" href="javascript:void(0);"><span style="background-position:0px -2553px"></span><span>Mongolia</span><span>+976</span></a></li>
      <li><a cunt_code="+382" href="javascript:void(0);"><span style="background-position:0px -2167px"></span><span>Montenegro</span><span>+382</span></a></li>
      <li><a cunt_code="+1664" href="javascript:void(0);"><span style="background-position:0px -583px"></span><span>Montserrat</span><span>+1664</span></a></li>
      <li><a cunt_code="+212" href="javascript:void(0);"><span style="background-position:0px -2333px"></span><span>Morocco</span><span>+212</span></a></li>
      <li><a cunt_code="+258" href="javascript:void(0);"><span style="background-position:0px -638px"></span><span>Mozambique</span><span>+258</span></a></li>
      <li><a cunt_code="+95" href="javascript:void(0);"><span style="background-position:0px -11px"></span><span>Myanmar</span><span>+95</span></a></li>
      <li><a cunt_code="+264" href="javascript:void(0);"><span style="background-position:0px -1881px"></span><span>Namibia</span><span>+264</span></a></li>
      <li><a cunt_code="+674" href="javascript:void(0);"><span style="background-position:0px -1749px"></span><span>Nauru</span><span>+674</span></a></li>
      <li><a cunt_code="+977" href="javascript:void(0);"><span style="background-position:0px -110px"></span><span>Nepal</span><span>+977</span></a></li>
      <li><a cunt_code="+31" href="javascript:void(0);"><span style="background-position:0px -1441px"></span><span>Netherlands</span><span>+31</span></a></li>
      <li><a cunt_code="+687" href="javascript:void(0);"><span style="background-position:0px -1276px"></span><span>New Caledonia</span><span>+687</span></a></li>
      <li><a cunt_code="+64" href="javascript:void(0);"><span style="background-position:0px -1540px"></span><span>New Zealand</span><span>+64</span></a></li>
      <li><a cunt_code="+505" href="javascript:void(0);"><span style="background-position:0px -154px"></span><span>Nicaragua</span><span>+505</span></a></li>
      <li><a cunt_code="+227" href="javascript:void(0);"><span style="background-position:0px -550px"></span><span>Niger</span><span>+227</span></a></li>
      <li><a cunt_code="+234" href="javascript:void(0);"><span style="background-position:0px -2476px"></span><span>Nigeria</span><span>+234</span></a></li>
      <li><a cunt_code="+683" href="javascript:void(0);"><span style="background-position:0px -2079px"></span><span>Niue</span><span>+683</span></a></li>
      <li><a cunt_code="+6723" href="javascript:void(0);"><span style="background-position:0px -209px"></span><span>Norfolk Island</span><span>+6723</span></a></li>
      <li><a cunt_code="+1" href="javascript:void(0);"><span style="background-position:0px -704px"></span><span>Northern Mariana Islands</span><span>+1</span></a></li>
      <li><a cunt_code="+47" href="javascript:void(0);"><span style="background-position:0px -836px"></span><span>Norway</span><span>+47</span></a></li>
      <li><a cunt_code="+968" href="javascript:void(0);"><span style="background-position:0px -2454px"></span><span>Oman</span><span>+968</span></a></li>
      <li><a cunt_code="+92" href="javascript:void(0);"><span style="background-position:0px -2035px"></span><span>Pakistan</span><span>+92</span></a></li>
      <li><a cunt_code="+680" href="javascript:void(0);"><span style="background-position:0px -231px"></span><span>Palau</span><span>+680</span></a></li>
      <li><a cunt_code="+970" href="javascript:void(0);"><span style="background-position:0px -1199px"></span><span>Palestinian Territories</span><span>+970</span></a></li>
      <li><a cunt_code="+507" href="javascript:void(0);"><span style="background-position:0px -847px"></span><span>Panama</span><span>+507</span></a></li>
      <li><a cunt_code="+63" href="javascript:void(0);"><span style="background-position:0px -1485px"></span><span>Papua New Guinea</span><span>+63</span></a></li>
      <li><a cunt_code="+595" href="javascript:void(0);"><span style="background-position:0px -2344px"></span><span>Paraguay</span><span>+595</span></a></li>
      <li><a cunt_code="+51" href="javascript:void(0);"><span style="background-position:0px -946px"></span><span>Peru</span><span>+51</span></a></li>
      <li><a cunt_code="+63" href="javascript:void(0);"><span style="background-position:0px -1815px"></span><span>Philippines</span><span>+63</span></a></li>
      <li><a cunt_code="+48" href="javascript:void(0);"><span style="background-position:0px -1177px"></span><span>Poland</span><span>+48</span></a></li>
      <li><a cunt_code="+351" href="javascript:void(0);"><span style="background-position:0px -517px"></span><span>Portugal</span><span>+351</span></a></li>
      <li><a cunt_code="+1787" href="javascript:void(0);"><span style="background-position:0px -473px"></span><span>Puerto Rico</span><span>+1787</span></a></li>
      <li><a cunt_code="+974" href="javascript:void(0);"><span style="background-position:0px -462px"></span><span>Qatar</span><span>+974</span></a></li>
      <li><a cunt_code="+262" href="javascript:void(0);"><span style="background-position:0px -264px"></span><span>Reunion</span><span>+262</span></a></li>
      <li><a cunt_code="+40" href="javascript:void(0);"><span style="background-position:0px -671px"></span><span>Romania</span><span>+40</span></a></li>
      <li><a cunt_code="+7" href="javascript:void(0);"><span style="background-position:0px -660px"></span><span>Russia</span><span>+7</span></a></li>
      <li><a cunt_code="+250" href="javascript:void(0);"><span style="background-position:0px -2674px"></span><span>Rwanda</span><span>+250</span></a></li>
      <li><a cunt_code="+599" href="javascript:void(0);"><span style="background-position:0px -2719px"></span><span>Saba</span><span>+599</span></a></li>
      <li><a cunt_code="+590" href="javascript:void(0);"><span style="background-position:0px -1012px"></span><span>Saint Barthélemy</span><span>+590</span></a></li>
      <li><a cunt_code="+290" href="javascript:void(0);"><span style="background-position:0px -495px"></span><span>Saint Helena</span><span>+290</span></a></li>
      <li><a cunt_code="+1869" href="javascript:void(0);"><span style="background-position:0px -99px"></span><span>Saint Kitts and Nevis</span><span>+1869</span></a></li>
      <li><a cunt_code="+1758" href="javascript:void(0);"><span style="background-position:0px -1397px"></span><span>Saint Lucia</span><span>+1758</span></a></li>
      <li><a cunt_code="+590" href="javascript:void(0);"><span style="background-position:0px -55px"></span><span>Saint Martin</span><span>+590</span></a></li>
      <li><a cunt_code="+508" href="javascript:void(0);"><span style="background-position:0px -1078px"></span><span>Saint Pierre and Miquelon</span><span>+508</span></a></li>
      <li><a cunt_code="+1784" href="javascript:void(0);"><span style="background-position:0px -2619px"></span><span>Saint Vincent Grenadines</span><span>+1784</span></a></li>
      <li><a cunt_code="+685" href="javascript:void(0);"><span style="background-position:0px -2300px"></span><span>Samoa</span><span>+685</span></a></li>
      <li><a cunt_code="+378" href="javascript:void(0);"><span style="background-position:0px -2123px"></span><span>San Marino</span><span>+378</span></a></li>
      <li><a cunt_code="+239" href="javascript:void(0);"><span style="background-position:0px -2388px"></span><span>Sao Tome and Principe</span><span>+239</span></a></li>
      <li><a cunt_code="+966" href="javascript:void(0);"><span style="background-position:0px -33px"></span><span>Saudi Arabia</span><span>+966</span></a></li>
      <li><a cunt_code="+221" href="javascript:void(0);"><span style="background-position:0px -2134px"></span><span>Senegal</span><span>+221</span></a></li>
      <li><a cunt_code="+381" href="javascript:void(0);"><span style="background-position:0px -2465px"></span><span>Serbia</span><span>+381</span></a></li>
      <li><a cunt_code="+248" href="javascript:void(0);"><span style="background-position:0px -1045px"></span><span>Seychelles</span><span>+248</span></a></li>
      <li><a cunt_code="+232" href="javascript:void(0);"><span style="background-position:0px -737px"></span><span>Sierra Leone</span><span>+232</span></a></li>
      <li><a cunt_code="+65" href="javascript:void(0);"><span style="background-position:0px -22px"></span><span>Singapore</span><span>+65</span></a></li>
      <li><a cunt_code="+1721" href="javascript:void(0);"><span style="background-position:0px -2773px"></span><span>Sint Maarten</span><span>+1721</span></a></li>
      <li><a cunt_code="+421" href="javascript:void(0);"><span style="background-position:0px -2212px"></span><span>Slovakia</span><span>+421</span></a></li>
      <li><a cunt_code="+386" href="javascript:void(0);"><span style="background-position:0px -1221px"></span><span>Slovenia</span><span>+386</span></a></li>
      <li><a cunt_code="+677" href="javascript:void(0);"><span style="background-position:0px -1067px"></span><span>Solomon Islands</span><span>+677</span></a></li>
      <li><a cunt_code="+252" href="javascript:void(0);"><span style="background-position:0px -1364px"></span><span>Somalia</span><span>+252</span></a></li>
      <li><a cunt_code="+27" href="javascript:void(0);"><span style="background-position:0px -2355px"></span><span>South Africa</span><span>+27</span></a></li>
      <li><a cunt_code="+211" href="javascript:void(0);"><span style="background-position:0px -2741px"></span><span>South Sudan</span><span>+211</span></a></li>
      <li><a cunt_code="+34" href="javascript:void(0);"><span style="background-position:0px -1155px"></span><span>Spain</span><span>+34</span></a></li>
      <li><a cunt_code="+94" href="javascript:void(0);"><span style="background-position:0px -2641px"></span><span>Sri Lanka</span><span>+94</span></a></li>
      <li><a cunt_code="+249" href="javascript:void(0);"><span style="background-position:0px -352px"></span><span>Sudan</span><span>+249</span></a></li>
      <li><a cunt_code="+597" href="javascript:void(0);"><span style="background-position:0px -2663px"></span><span>Suriname</span><span>+597</span></a></li>
      <li><a cunt_code="+268" href="javascript:void(0);"><span style="background-position:0px -2278px"></span><span>Swaziland</span><span>+268</span></a></li>
      <li><a cunt_code="+46" href="javascript:void(0);"><span style="background-position:0px -385px"></span><span>Sweden</span><span>+46</span></a></li>
      <li><a cunt_code="+41" href="javascript:void(0);"><span style="background-position:0px -1320px"></span><span>Switzerland</span><span>+41</span></a></li>
      <li><a cunt_code="+963" href="javascript:void(0);"><span style="background-position:0px -1826px"></span><span>Syria</span><span>+963</span></a></li>
      <li><a cunt_code="+886" href="javascript:void(0);"><span style="background-position:0px -506px"></span><span>Taiwan</span><span>+886</span></a></li>
      <li><a cunt_code="+992" href="javascript:void(0);"><span style="background-position:0px -187px"></span><span>Tajikistan</span><span>+992</span></a></li>
      <li><a cunt_code="+255" href="javascript:void(0);"><span style="background-position:0px -2289px"></span><span>Tanzania</span><span>+255</span></a></li>
      <li><a cunt_code="+66" href="javascript:void(0);"><span style="background-position:0px -957px"></span><span>Thailand</span><span>+66</span></a></li>
      <li><a cunt_code="+670" href="javascript:void(0);"><span style="background-position:0px -2784px"></span><span>Timor-Leste</span><span>+670</span></a></li>
      <li><a cunt_code="+228" href="javascript:void(0);"><span style="background-position:0px -605px"></span><span>Togo</span><span>+228</span></a></li>
      <li><a cunt_code="+690" href="javascript:void(0);"><span style="background-position:0px -2751px"></span><span>Tokelau</span><span>+690</span></a></li>
      <li><a cunt_code="+676" href="javascript:void(0);"><span style="background-position:0px -1089px"></span><span>Tonga</span><span>+676</span></a></li>
      <li><a cunt_code="+1868" href="javascript:void(0);"><span style="background-position:0px -440px"></span><span>Trinidad and Tobago</span><span>+1868</span></a></li>
      <li><a cunt_code="+216" href="javascript:void(0);"><span style="background-position:0px -539px"></span><span>Tunisia</span><span>+216</span></a></li>
      <li><a cunt_code="+90" href="javascript:void(0);"><span style="background-position:0px -1606px"></span><span>Turkey</span><span>+90</span></a></li>
      <li><a cunt_code="+993" href="javascript:void(0);"><span style="background-position:0px -2542px"></span><span>Turkmenistan</span><span>+993</span></a></li>
      <li><a cunt_code="+1649" href="javascript:void(0);"><span style="background-position:0px -1309px"></span><span>Turks and Caicos</span><span>+1649</span></a></li>
      <li><a cunt_code="+688" href="javascript:void(0);"><span style="background-position:0px -286px"></span><span>Tuvalu</span><span>+688</span></a></li>
      <li><a cunt_code="+256" href="javascript:void(0);"><span style="background-position:0px -1166px"></span><span>Uganda</span><span>+256</span></a></li>
      <li><a cunt_code="+380" href="javascript:void(0);"><span style="background-position:0px -2002px"></span><span>Ukraine</span><span>+380</span></a></li>
      <li><a cunt_code="+971" href="javascript:void(0);"><span style="background-position:0px -2223px"></span><span>United Arab Emirates</span><span>+971</span></a></li>
      <li><a cunt_code="+44" href="javascript:void(0);"><span style="background-position:0px -55px"></span><span>United Kingdom</span><span>+44</span></a></li>
      <li><a cunt_code="+1" href="javascript:void(0);"><span style="background-position:0px -44px"></span><span>United States</span><span>+1</span></a></li>
      <li><a cunt_code="+598" href="javascript:void(0);"><span style="background-position:0px -2608px"></span><span>Uruguay</span><span>+598</span></a></li>
      <li><a cunt_code="+998" href="javascript:void(0);"><span style="background-position:0px -1001px"></span><span>Uzbekistan</span><span>+998</span></a></li>
      <li><a cunt_code="+678" href="javascript:void(0);"><span style="background-position:0px -1265px"></span><span>Vanuatu</span><span>+678</span></a></li>
      <li><a cunt_code="+379" href="javascript:void(0);"><span style="background-position:0px -2322px"></span><span>Vatican City</span><span>+379</span></a></li>
      <li><a cunt_code="+58" href="javascript:void(0);"><span style="background-position:0px -1056px"></span><span>Venezuela</span><span>+58</span></a></li>
      <li><a cunt_code="+84" href="javascript:void(0);"><span style="background-position:0px -968px"></span><span>Vietnam</span><span>+84</span></a></li>
      <li><a cunt_code="+1284" href="javascript:void(0);"><span style="background-position:0px -1408px"></span><span>Virgin Islands, British</span><span>+1284</span></a></li>
      <li><a cunt_code="+1340" href="javascript:void(0);"><span style="background-position:0px -1782px"></span><span>Virgin Islands, US</span><span>+1340</span></a></li>
      <li><a cunt_code="+681" href="javascript:void(0);"><span style="background-position:0px -1012px"></span><span>Wallis and Futuna</span><span>+681</span></a></li>
      <li><a cunt_code="+967" href="javascript:void(0);"><span style="background-position:0px -1672px"></span><span>Yemen</span><span>+967</span></a></li>
      <li><a cunt_code="+260" href="javascript:void(0);"><span style="background-position:0px -1595px"></span><span>Zambia</span><span>+260</span></a></li>
      <li><a cunt_code="+263" href="javascript:void(0);"><span style="background-position:0px -2046px"></span><span>Zimbabwe</span><span>+263</span></a></li>
    </ul>
  </dd>
</dl>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

 

See also  Node.js Express Tutorial to Send Email Messages With Attachments Using NodeMailer Full Project

 

Now make a style.css file and copy paste the following code

 

style.css

 

body {
    font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
    background:#4a535f;
}
.wrapper {
    width:300px;
    margin:3% auto;
}
.dropdown dd, .dropdown dt, .dropdown ul {
    margin: 0px;
    padding: 0px;
}
.dropdown dd ul li a span:first-child, .dropdown dt a span span:first-child {
    background-image: url('https://i.imgur.com/OQiDoZe.png');
    background-repeat: no-repeat;
    width: 16px;
    height: 11px;
    display: inline-block;
    margin:5px;
    vertical-align: top;
}
.dropdown dt a span {
    cursor: pointer;
    display: block;
    padding: 5px;
    white-space: nowrap;
}
.dropdown dt a img {
    position: relative;
    z-index: 1;
}
.dropdown dt a span span:first-child:before {
    position: absolute;
    content: '';
    width: 15px;
    height: 10px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.2) inset;
}
.dropdown dt a span span {
    display: inline-block;
    padding: 0;
}
.dropdown dt a span span:first-child {
    padding: 0;
}
.dropdown dd {
    position: relative;
}
.dropdown a, .dropdown a:visited {
    color: #4a535f;
    text-decoration: none;
    outline: none;
}
.dropdown a:hover {
    color: #5d4617;
}
.dropdown dt a:hover, .dropdown dt a:focus {
    color: #5d4617;
}
.dropdown dt a {
    position: relative;
    background: #e3e6ef;
    display: block;
    padding-right: 20px;
    overflow: hidden;
    border:1px solid #ed4267;
    width:250px;
}
.dropdown dt a:after {
    content: '';
    background: #ed4267;
    position: absolute;
    
    height: 32px;
    position: absolute;
    right: 0;
    top: 0;
    width: 35px;
}

.dropdown dt a:before {
    background: none repeat scroll 0 0 #FFFFFF;
    content: "";
    height: 3px;
    position: absolute;
    right: 7px;
    top: 6px;
    width: 20px;
    z-index: 2;
    box-shadow:0 8px 0 #FFFFFF, 0 16px 0 #FFFFFF;
}
.dropdown dd ul {
    background: #f0f2f7;
    
    color: #C5C0B0;
    display: none;
    left: 0px;
    padding: 5px 0px;
    position: absolute;
    
    width: 270px;
    border:1px solid #ed4267;
    list-style: none;
    max-height: 170px;
    overflow-y: scroll;
    top:10px;
    z-index: 2;
}

li a {
    font-size:13px;
}

li a span:nth-child(2) {
    line-height: 2em;
}
.dropdown dd ul::-webkit-scrollbar-track {
 -webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0.3);
 border-left:1px solid rgba(0,0,0,0.1);
}
.dropdown dd ul::-webkit-scrollbar-thumb {
 background: rgba(0,0,0,0.4);
/*-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0.5), 1px 0 0 #5cace9 inset, 2px 0 0 #b3d5ee inset;
    border-radius:10px;*/
}
.dropdown dd ul::-webkit-scrollbar-thumb:window-inactive {
 background: blue;
}
.dropdown span.value {
    display: none;
}
.dropdown dd ul li a {
    padding: 5px;
    display: block;
    font-size: 12px !important;
}
.dropdown dd ul li a:hover {
    background-color: rgba(0,0,0,0.05);
}
dl.dropdown {
    display: inline-block;
    width: 240px;
    margin: -3px 0 0 1px;
}
dl.dropdown span:nth-child(3) {
    color: rgba(0,0,0,0.4)
}
dl.dropdown > span:nth-child(2) {
    overflow: hidden;
    white-space: nowrap;
    display: inline-block;
}
dl.dropdown span:nth-child(3) {
    float: right;
}
dl.dropdown dt span:nth-child(2) {
    color: rgba(0, 0, 0, 0.6);
    font-size: 14px;
    font-weight: bold;
    line-height: 1.6em;
}
dl.dropdown dt span:nth-child(3) {
    display: none;
}
.countryFlag {
    padding: 0;
    background-image: url("https://i.imgur.com/OQiDoZe.png");
    background-repeat: no-repeat;
    display: inline-block;
    height: 11px;
    margin-right: 4px;
    width: 16px;
    cursor: pointer;
    white-space: nowrap;
    -moz-border-bottom-colors: none;
    -moz-border-left-colors: none;
    -moz-border-right-colors: none;
    -moz-border-top-colors: none;
    border-color: #BFBFC1 #B6B6B6 #969696;
    border-image: none;
    border-radius: 2px 2px 2px 2px;
    border-style: solid;
    border-width: 1px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.09);
}
/*.countryFlag:before {*/
    /*-moz-border-bottom-colors: none;*/
    /*-moz-border-left-colors: none;*/
    /*-moz-border-right-colors: none;*/
    /*-moz-border-top-colors: none;*/
    /*background: linear-gradient(to bottom, #FFFFFF 0%, #EEEEEE 100%) repeat scroll 0 0 transparent;*/
    /*border-color: #BFBFC1 #B6B6B6 #969696;*/
    /*border-image: none;*/
    /*border-radius: 2px 2px 2px 2px;*/
    /*border-style: solid;*/
    /*border-width: 1px;*/
    /*box-shadow: 0 1px 1px rgba(0, 0, 0, 0.09);*/
    /*display: block;*/
    /*overflow: hidden;*/
    /*padding-right: 20px;*/
    /*position: relative;*/
    /*width: 25px;*/
/*}*/

 

See also  Node.js Express Youtube Data API V3 Upload Video to Youtube in Javascript Full Project For Beginners

 

Now make a script.js file and copy paste the following code

 

script.js

 

function setCountry(code){
        if(code || code==''){
            var text = jQuery('a[cunt_code="'+code+'"]').html();
            $(".dropdown dt a span").html(text);
        }
    }
    $(document).ready(function() {
        $(".dropdown img.flag").addClass("flagvisibility");

        $(".dropdown dt a").click(function() {
            $(".dropdown dd ul").toggle();
        });

        $(".dropdown dd ul li a").click(function() {
            //console.log($(this).html())
            var text = $(this).html();
            $(".dropdown dt a span").html(text);
            $(".dropdown dd ul").hide();
            $("#result").html("Selected value is: " + getSelectedValue("country-select"));
        });

        function getSelectedValue(id) {
            //console.log(id,$("#" + id).find("dt a span.value").html())
            return $("#" + id).find("dt a span.value").html();
        }

        $(document).bind('click', function(e) {
            var $clicked = $(e.target);
            if (! $clicked.parents().hasClass("dropdown"))
                $(".dropdown dd ul").hide();
        });


        $("#flagSwitcher").click(function() {
            $(".dropdown img.flag").toggleClass("flagvisibility");
        });
    });

 

See also  Build a Digital Analog Clock in Browser Using HTML5 CSS3 and Javascript Full Project For Beginners

 

Now if you open the index.html file inside the browser you will see the below screenshot

 

Leave a Reply