Skip to content

Instantly share code, notes, and snippets.

@SamMarkiewicz
Last active October 12, 2015 23:57
Show Gist options
  • Save SamMarkiewicz/4106538 to your computer and use it in GitHub Desktop.
Save SamMarkiewicz/4106538 to your computer and use it in GitHub Desktop.
Removes <p> around <img> for Tumblr text
// Create the var according to your needs :
var wrappedImg = $('[higher-selector-that-contains-img]').find('img')
wrappedImg.closest('p > *').unwrap(); //Allow p suppression even if the structure changes - i.e if you put link on your img
// Exemple :
// var wrappedImg = $('section').find('img')
// wrappedImg .unwrap('p');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment