how to get a click or a tab to select either north, west, or center panel?
This is tab code works but don’t know how to integrate it with a click-panel code
JAVASCRIPT :
$(document).ready(function(){
var divs = ["north", "west", "center"];
var startIndex = 0;
$(document).keydown(function(e) {
if (e.which == 9) {
$("div").css("border", "");
$("#" + divs[startIndex]).css("border", "4px solid gray");
if(divs[startIndex] == "north"){
alert("north");
}else if(divs[startIndex] == "west"){
alert("west");
}else{
alert("center");
}
startIndex++;
if(startIndex === divs.length) {
startIndex = 0;
}
}
return false;
});
});
HTML :
<div id="north"><textarea></textarea></div>
<div id="west"><textarea></textarea></div>
<div id="center"><textarea></textarea></div>
Assuming you want the same functionality to happen when you click as when you tab you want something like this:
There is a common function that is used to do the background highlighting and such that is invoked from either the
keydownor theclickhandle.Demo here – http://jsfiddle.net/slace/D39P3/