jquery - Trying to use javascript to fill a tag of button class -
edit 3: i'm going kind of start over.
i can't post 2 links theme i'm using red ink themeforest , page i'm working on portfolio page if want google it.
when click 1 of portfolio items "true gangsters" info pulled div , plugged previous section formatting.
all want add button these portfolio items , able pull link div , have formatted button.
in jsfiddle included formatted div , "true gangsters" section formatted div gets info from.
i included of portfolio part javascript i'm pretty sure important part:
//update text info function updatetext(current) { var title = current.attr('data-title'); var desc = current.attr('data-description'); var date = current.attr('data-date'); controls.find('h2').html(title); controls.find('p').html(desc); controls.find('.date .day').html(date.split(',')[0]); controls.find('.date .month').html(date.split(',')[1]); controls.find('.date .year').html(date.split(',')[2]); } //end update text info
this proving more complicated thought be.
old section, ignore me:
so i'm trying use javascript chunk of code part of webpage , insert different part create link on
<div class="button"></div> <div class="getvid" data-epdlink="cdddy5nva3a" >
so want piece of code getvid div , put button div link.
so have bit of javascript:
var endlink = current.attr('data-epdlink'); var fulllink = '<a href="https://www.youtube.com/watch?v=' + endlink +'">"click video"</a>'; controls.find('button').html(fulllink)
it doesn't seem work. i've used type of thing before insert headers , text i'm thinking there's different i've got insert code.
any ideas?
here's link fiddle if helps: [jsfiddle][3]
edit
forgot mention there multiple getvid classes depends on 1 have open , data-epdlink different each.
edit 2
ok in new jsfiddle can see of formatting in top part of html labeled vid item formatting. next 2 items each labeled vid item pull info vid formatting section using javascript. code template i'm not entirely sure what's going on included javascript changes image on each vid item section because think change button link using along lines. can see button div right after both of tables in vid formatting section.
new jsfiddle here: [new js fiddle][4]
edit 3: i'm going kind of start over. first off here's template i'm using [red ink template][1]
when click 1 of portfolio items "true gangsters" info pulled div , plugged previous section formatting.
all want add button these portfolio items , able pull link div , have formatted button.
this proving more complicated thought be.
first, need close .getvid
div. best practice use data()
method access data-
attributes:
var endlink = current.data('epdlink'); var fulllink = '<a href="https://www.youtube.com/watch?v=' + endlink +'">"click video"</a>'; controls.filter('.button').html(fulllink);
you lowercase, e.g. edplink
. believe variable controls
collection of html elements, whenever have search in pre-selected collection use .filter()
.
Comments
Post a Comment