jsonform / jsonform

Build forms from JSON Schema. Easily template-able. Compatible with Bootstrap 3 out of the box.
https://jsonform.github.io/jsonform/playground/index.html
MIT License
2.72k stars 553 forks source link

How to add class on label tag #424

Closed ajayexpert closed 1 year ago

ajayexpert commented 1 year ago

How to add class on label tag

sdetweil commented 1 year ago

which jsonform element are you mentioning? as we don't have a 'label' thing..

ajayexpert commented 1 year ago

I meant for class on title since i am not using bootstrap using tailwind css so need to give css for title as well.

image

sdetweil commented 1 year ago

ok, what I did on my app was use a little jquery on the result of the jsonform output to set styles

https://stackoverflow.com/questions/4844594/jquery-select-the-associated-label-element-of-a-input-field

the .closest() method will locate the nearest parent // find the element with htmlclassname find its closest parent label element, and apply these styles

$(.htmlclassname).closest('label').css(...)
sdetweil commented 1 year ago

closing answer given, reopen if needed