Home › Forums › Backend Issues (wp-admin) › Jquery oEmbed value event › Reply To: Jquery oEmbed value event
Oh, now i got it. the problem seem to be with my rows that are added by jquery.
If i use your code with a row already exists it works, but on my code i add rows with jquery this way (to pull videos from youtube channel into those rows…):
$(document).on('mouseup','.get_yt_videos_from_channel',function(e){
var ycLink = $('[data-name="yt_channel_url"] input').val();
var channelID = ycLink.split("/")[4];
// If has youtube channel
if(channelID){
$.get(
"https://www.googleapis.com/youtube/v3/search",{
part : 'snippet',
channelId : 'UCtGv4fb0btvvi9pGOt0UrEA',
type : 'video',
key: 'AIzaSyB_VnQhWmlxX0Z9kH_s3bejItXt04lYb6w'},
function(data) {
$.each( data.items, function( i, item ) {
$('[data-key="field_602ea4a8fe1ab"] a[data-event="add-row"]').last().trigger('click');
var addedRow = $('[data-key="field_602ea4a8fe1ab"] .acf-clone').prev();
addedRow.find('[data-name="yt_title"] input').val(item.snippet.title);
addedRow.find('[data-name="yt_url"] input').val('https://www.youtube.com/watch?v='+item.id.videoId);
})
}
);
$(document).find('input').trigger('change');
}
// If doesn't have youtube channel - alert Error
else {
alert('You don't have a youtube channel url defined');
}
And when added like that the preview won’t load even i then type it manually into to the ‘.input-search’.
Any idea why?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.