I’m trying to make a pretty different version of a web page for mobile and, for that to happen, I need certain divs to disappear when the browser window width is bigger then 767px. I was trying to do it with jQuery with something like this:
<script>
if ( $('body').width > 767px ) {
$('.mobile').remove();
}
</script>
but it doesn’t work at all.
The divs that I want to disappear in the bigger version have the class .mobile .
You don’t necessarily need JS for that. Have you looked at media queries ?
if you still want to use jQuery: