Created
September 20, 2014 03:46
-
-
Save neatville/7191a726a3ba2494f4e8 to your computer and use it in GitHub Desktop.
Use jQuery replaceWith for easy yet powerful DOM manipulation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var href = $(".link").attr("href"); | |
var textOf = $(".link").text(); | |
$( "a" ).click(function() { | |
$( this ).replaceWith( "<textarea autofocus>" + href + " -> " + textOf + "</textarea>" ); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment