jQuery – Forms And Automatic Selectors

Although VitoshAcademy is not an  Academy, there should be some educational stuff. Thus, in this article I have decided to put something educational. 🙂

Let’s see how to make a simple selector in jQuery, which updates below some text, based on the selection. Thus, we have three different selectors, as in the picture:

jqforms

Each selector has 4 two-letter abbreviations, which are related to cities in Bulgaria, Netherlands and Spain. Once you select anything on any of the selectors, an action is triggered. An array of the selected items is serialized and based on the name of the selector, the results are displayed. What is interesting to see is the removal of the <hr> and its adding through JS. Both were not known for me, before starting the article.

Its better to see the code, than to speak about it.

Here it goes:

Available also in GitHub here.

Enjoy it! 🙂

Tagged with: , , ,