Using Javascript to change all textareas in an html page
I am creating a project in Django, and I am using the Django Admin pages along with TinyMCE. But I would like to be able to toggle TinyMCE on and off like in this example:
http://tinymce.moxiecode.com/examples/exa开发者_JAVA百科mple_01.php
but since the admin page is generated automatically I imagine I need to overide the base_site.html template which I can do. But my question is "Is there any way I can have something like -- if is textarea ..... -- in javascript?"
Thanks
You can use
document.getElementsByTagName("textarea")
to return an array of all the <textarea/> elements. Then iterate over it and do with it as you will.
精彩评论