Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams There is no way to do this with jQuery, because all browsers implement the decodeURIComponent function for Javascript, as Darin's answer below explains - consider replacing "jquery" tag w/ "javascript"? Jon z Apr 19, 2013 at 15:54

Try the decodeURIComponent function:

var decodedUri = decodeURIComponent('http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg');
alert(decodedUri);
                But that doesn't use jQuery (and please don't link to W3Schools, they are good at SEO and poor at teaching correct information)!
– Quentin
                Sep 27, 2010 at 12:38
                Well I dont see the point to use jQuery when a native javascript function can do it. And what's matter about W3Schools? is not a place where you are going to ask a COMPLEX specific question about programming but at least works as reference or introduction for an general problem. I don't see any bad with that.
– ncubica
                Mar 11, 2012 at 1:30
                @nahum W3C (World Wide Web Consortium) is actually a very good place to get the right information. w3schools, who has NOTHING to do with W3C, isn't. I assume you know the difference between them and that it was just a typo. However, you just demonstrated why they choosed that name and how easy it is to get it mixed up. If you want to continue using them, even though you know that the information they have is misleading  or wrong, instead of using something that is easily accessible and with better information, no one will stop you. But you will get complaints when you publicly link to them.
– some
                Mar 31, 2013 at 7:56
                @AdriánSalgado, why looking for a function in jQuery when this function already exists in plain javascript? I mean that would be like reinventing the wheel, wouldn't it? Check that out: i.stack.imgur.com/ssRUr.gif
– Darin Dimitrov
                Feb 25, 2014 at 22:57

Use decodeURIComponent(), for example:

decodeURIComponent("http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg")

It's not jQuery specific, this is a base JavaScript function.

You can simply call the standard javascript functions for encoding and decoding respectively.

encodeURIComponent
decodeURIComponent

Enjoy!

If you URL should also contain blanks encoded as '+', the following call will help (taken from https://stackoverflow.com/a/4458580/430742):

decodeURIComponent((str+'').replace(/\+/g, '%20'))
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.