I am totally new to jQuery. I spent quite a bit of time researching how to get jQuery to work in the Django Admin, specifically using the change_form.html.
In the {% block extrahead %} in the change_form.html template I eventually found out that I should write:
<script type="text/javascript">
(function($){
$(function(){
$("#id_fs1").attr("style", "width:10px");
});
})(django.jQuery);
<script>
It worked like a charm but in the end it looks quite convoluted compared to:
<script type="text/javascript">
document.getElementById("id_fs1").style.width = "50px";
</script>
(the above was placed in the {% block after_field_sets %})
My question is... Is there a more elegant way of using jQuery within the Django admin?