change portlet title from code in Liferay without Jquery

[亡魂溺海] 提交于 2019-12-24 12:00:22

问题


I'm having solution to change title of portlet through JQuery.

$('#idOfPortlet').find('.portlet-title').html('new title');

But we dont want to use JQuery in our project. Is there any solution to change title of portlet using YUI or anyother thing through code?

Thanks in Advance.

Regards, Mayur Patel


回答1:


If the version of Liferay you're on is using YUI 3, then this aught to do it:

Y.one('#idOfPortlet .portlet-title').setContent('new title');

I'm not sure if Liferay exposes the YUI instance as Y, or if they wrap it in AUI and make it A.




回答2:


You can do so, by using this code -

document.getElementsByClassName('.portlet-title')[0].content = 'something else as title'


来源:https://stackoverflow.com/questions/7551639/change-portlet-title-from-code-in-liferay-without-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!