查找当前关注的组件ID以显示在线/上下文帮助系统 [英] Find Current focused component ID to Show Online / Context HelpSystem
问题描述
方法1.按F1键 -
方法2将鼠标移动到一个(帮助)图标上
然后根据当前聚焦的组件ID从数据库中获取上下文ID的文本将被挑选并显示在屏幕上。
我们如何在不使用javascript / jQuery的情况下获得当前集中的组件id?
$(document).ready(function(){
$(body)。delegate(:input,focus点击,函数(){
if($(this).attr('id')!='hiddenInput'& amp; amp; $(this).attr('id')!= 'helpButton'){
$('#hiddenInput')。val($(this).attr('id'));
}
});
}) ;
I want to implement online (context) help for my primefaces pages. I am considering the id of a component as the context_id and for each context Id, help text is available in the database. When user wants help on a component, focus should be there in the component and user has to
Method 1. Press F1-key
Method 2. Move mouse on to a (help) icon
Then help text from the database for the context id as per the currently focused component id will be picked and shown on screen.
How can we get the currently focused component id without using javascript / jQuery ?
Following jQuery is the solution for my problem. This Updates a hidden inputText on visiting each component (but skips this on click of help button itself). On click of help button, the id of the active component is obtained from the hidden inputText and help is extracted for that ID from resource bundle (My resource bundle is created from database having the help text for each component ID)
$(document).ready(function(){
$("body").delegate(":input", "focus click", function(){
if($(this).attr('id') != 'hiddenInput' && $(this).attr('id') != 'helpButton'){
$('#hiddenInput').val($(this).attr('id'));
}
});
});
这篇关于查找当前关注的组件ID以显示在线/上下文帮助系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!