Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Javascript-interface for repeat elements function

From MoodleDocs

Adding new blank answer requires page-reloading. It's not comfortable. Using advanced opportunities of YUI library we can realize adding blank choices without it. Button "Blanks for 3 more Choices" will be changed to "Add blank choise".http://imglink.ru/pictures/21-09-10/f85258328f02d65164e6a15644e5d8a9.jpg

Pushing button Add blank choise will add one empty answer to the page without reloading.

Another addition is removing answers from page withou reloading. Removing answer will be able, if all text fields(input text or textarea) are empty. Pushing button http://imglink.ru/pictures/21-09-10/36894a2cd789d3916c86f12105b96d42.jpg while all text fields are empty will ask confirmation using confirm dialog. http://imglink.ru/pictures/21-09-10/68342df9db64b00f69b4dcd15edba37f.jpg If text fields are not empty, like here http://imglink.ru/pictures/21-09-10/797d7f513ce2c3588e4be3e216f4b767.jpg you will see alert dialog http://imglink.ru/pictures/21-09-10/166ccbfe86c3f9d14d7c8b2aef88bbdb.jpg