Search code examples
javascriptjqueryiframeencodingeditor

Wordpress Editor converts ampersand to &


when I am setting the src of an iframe dynamically with the following javascript in Wordpress:

jQuery(document).ready(function(){ 
    jQuery('iframe').attr('src', 'http://someurl.com/?originid=PORTAL&tijdsblokstart=1700&datum=2014-05-19'); 
});

The last 2 parameters are not picked up. I know it has someting to do with the encoding of the ampersand, but I tried everything...I'm lost now.

 - &
 - &
 - &
 - creating the whole iframe in jQuery 

The src has to be set dynamically.

Thanks!


Solution

  • I fixed my issue by creating a function in an external js-file that generates the url for me. So avoid using the ampersand in the Wordpress editor. I would love to hear if someone comes up with a better solution. http://codex.wordpress.org/Using_Javascript