page banner
avatar
'Dynamically add and remove HTML blocks with Grails tag library and JQuery' post illustration
Dynamically add and remove HTML blocks with Grails tag library and JQuery

This post shows how to create Grails tag library for adding and removing identical HTML blocks, which can be used when you want to give user an option to dynamically add extra inputs for additional information. There are lots of simple JQuery and pure JavaScript solutions for this feature, but, in general, they are not flexible and clean enough for a Grails application. Pure tag library approach helps to avoid HTML and JS clutter in a GSP file and speeds up the development, since the only thing you need is to specify the tag with necessary parameters.