How to set a function key(f2) for rename a tab
In the attached screen shot you can she that to rename a selected tab we have to click on it, and to delete a tab we need a mouse hover on the unselecte开发者_C百科d tab. Now this events are not key board accessible. For this I want to set the f2 key for rename, ie. when a tab is selected I can rename it by pressing the f2 key and to delete the tab I want to fix the delete button on the tab instead of a mouse hover and can make it key board accessible.
Now I need the solution for both of this two problem and I can provide the css code for deleting the tab.
.js .delete-tab {
background: url(../images/common/remove.png) no-repeat 42%;
cursor: pointer;
display: block;
height: 8px;
position: absolute;
right: 2px;
text-indent: -9999em;
top: 2px;
width: 8px;
}
The jQuery way:
$('body').keydown(function(e) {
if (e.which === 113) {
// F2 was pressed
// e.target holds a reference to the current DOM element
}
});
精彩评论