jQuery: Find the element with a particular custom attribute
I think what you need is:
var number = 6;
var myDiv = $('[data-divNumber="'+number+'"]');
You need to do some string addition to get the number into your selector and the value needs to be quoted.
var number = 6;
var myDiv = $('[data-divNumber="' + number + '"]');
What you're trying to produce after the string addition is this result:
$('[data-divNumber="6"]');
var number = 6;
var myDiv = $('div[data-divNumber="' + number + '"]');