0
I have a function to create extra fields in the profile editor of users of a site in Wordpress. A part of it creates two image upload fields (media Uploader with thickbox), and a snippet in jQuery to fill in a text input with the image URL, and a placeholder (img) with the image itself. That’s basically the result:
The media Uploader must provide the url with:
var imgurl = $( 'img', html ).attr( 'src' );
It’s working normally on localhost, but when I put it on the server, it doesn’t work. The log shows "Undefined", and interestingly only in Chrome (but works in Chrome on localhost).
Any ideas? If relevant, I can post the entire code.
if you change the var imgurl to a fixed value it works?
– Ricardo BRGWeb
Yes, it works normal. So I guess there’s only one problem left with the
$( 'img', html ).attr( 'src' );
(I just don’t know which...)– Daniel Lemes
I think the problem is using $... check out: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers
– Ricardo BRGWeb