djangosnippets.org: Latest snippets tagged with 'dynamic-css'https://djangosnippets.org/tags/dynamic-css/2011-07-13T17:06:25.685091-05:00Dynamically add css-classes to formfields
2011-07-13T17:06:25.685091-05:00Lacourhttps://djangosnippets.org/snippets/2487/<p>This example assumes you have a form and want to highlight one of two fields
by setting <class="highlight"> in the html dynamically. This is an alternative to
<a href="https://docs.djangoproject.com/en/1.3/ref/forms/widgets/#customizing-widget-instances">https://docs.djangoproject.com/en/1.3/ref/forms/widgets/#customizing-widget-instances</a>,
but now you're not limited to assigning the class to the fields html-output,
instead you can also assign it to a …</p>
Freely redistributable