Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save felipeabajo/b93588cfd5c039366d540efdcf38a8dc to your computer and use it in GitHub Desktop.
Save felipeabajo/b93588cfd5c039366d540efdcf38a8dc to your computer and use it in GitHub Desktop.
String replacement with media queries in jQuery
jQuery(document).ready(function( $ ){
if (window.matchMedia('(min-width: 767px)').matches) {
var test = jQuery(".hide-text:nth-of-type(2)").html(); jQuery(".hide-text:nth-of-type(2)").html(test.replace('text',''));
var test = jQuery(".hide-text:nth-of-type(1)").html(); jQuery(".hide-text:nth-of-type(1)").html(test.replace('text',''));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment