I have a problem with some JavaScript: for the computer version of a website, when I hover over a button, some text appears, and when I click anywhere else on the site, the text hides.
I don't know how to construct a page for the mobile version of the same website, on which when I click on a button, text shall appear and when I click anywhere else I want the text to hide. I've tried:
if(jQuery.browser.mobile) {
$(".button").on("click", function() {
$(".text").show();
});
//this section doesn't work
$("body").on("click", function() {
$(".text").hide();
});
}
else {
//desktop code here, irrelevant
}