0

我有一个 django 模型,其中包括几个只读文本区域和文本。例如:

class FormTask(forms.Form):
     name = forms.CharField(required = False, max_length = 300, 
                widget = forms.TextInput(attrs = {"readonly" : "readonly"}),
                label = "task name")
     id = forms.CharField(required = False, max_length = 300, 
                widget = forms.TextInput(attrs = {"readonly" : "readonly"}),
                label = "task ID")
     script = forms.CharField(required = False, max_length = 2000, 
                widget = forms.Textarea(attrs = {"readonly" : "readonly"}),
                label = "task script")

当我使用 jquery 将模型渲染到 html 页面时,我发现 textarea(script) 无法填充命令,并且这个 textarea 是只读的,所以我想动态更改它的大小。如果我想改变它的大小,你能告诉我该怎么做吗?非常感谢!

4

1 回答 1

0
$("#textareaID").width(123);// by this 123 px width set
$("#textareaID").height(123);// by this 123 px height set

参考

高度

宽度

于 2013-08-22T10:41:10.680 回答