Skip to content

Latest commit

 

History

History

custom-html-generator

Customize the HTML Id attribute generated by Tag Helper to snake_case instead of the current default one

By default, the Tag Helper will generate something akin to "Input_FirstName" for the first text field. This is off course quite annoying if you have to refer the element in JavaScript because it's an uncommon id naming convention.

The good thing is that you can customize the HTML that these Tag Helpers generate. Do a view source on this page and you will see that the ids are generated using snake_case.

The code here is originated from a mash up between:

close