简体   繁体   English

您如何使用JavaScript处理附加的HTML ID?

[英]How do you use javascript to handle appended HTML ID's?

This line of javascript assigns a WYSIWYG editor to an element with the HTML ID 'description'. 这行javascript将WYSIWYG编辑器分配给HTML ID为“ description”的元素。

 new nicEditor({fullPanel : true}).panelInstance('description')

The WYSIWYG editor then overrides the textarea. 然后,所见即所得编辑器将覆盖文本区域。

 <textarea 

   id="description[<?php echo $pid ?>]" 
   name="description[<?php echo $pid?>]" 

 </textarea>

But the ID tag changes as it iterates through all of the descriptions. 但是,ID标记会在遍历所有描述时发生变化。 The current $pid of the description is appended to the ID tag. 描述的当前$ pid将附加到ID标签。 (description1, description2 etc.) (描述1,描述2等)

How do you modify the javascript to handle each appended ID name? 您如何修改javascript以处理每个附加的ID名称?

new nicEditor({fullPanel : true}).panelInstance('description.???')

niEditor似乎不支持分配给类,最好将TinyMCE选择器选项结合使用,并为每个文本区域分配相同的类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM