The reference for this code snippet can be found at http://jsfiddle.net/4fV3k/
I have a function called SetGridBorder
that takes a border style parameter like 1px solid red
and a selector of the wrapper element such as box-wrapper
.
In my example, there are 4 rows in a row, resulting in 4 columns and 4 rows. How can I determine this using JavaScript and apply the border according to these rules?
The second and third cells in the top row should only have a missing left and right border (no duplicated border).
The second and third columns in the middle rows should only have a missing top and bottom border (no duplicated border here either).
Is there a suggested approach or better way to handle this in JavaScript? Any recommendations on how to improve it?
$(document).ready(function () {
var box_wrapper = $(".box-box-wrapper", ".box");
SetGridBorder(4,4)
});
function SetGridBorder(style,selector) {
}