Hi I have a dynamically created button created by a plugin I am using on my page. Basically, the element created by the javascript is a breadcrumb with a 'href'. I was hoping to take the same link and apply it to another button. However my theory is not working, how would you do this?
/* M Y C O D E */
var link5 = $('#sideButton5').attr('href');
$("#menu5").attr("href", ""+link5+"");
console.log(link5);
/* P L U G I N */
for (var i = 0; i < $(SECTION_SEL).length; i++) {
var link = '';
if (options.anchors.length) {
link = options.anchors[i];
}
li += '<li><a id="sideButton'+i+'" href="#' + link + '"><span class="fp-sr-only"></span><span></span></a>';
// Only add tooltip if needed (defined by user)
var tooltip = options.navigationTooltips[i];
if (typeof tooltip !== 'undefined' && tooltip !== '') {
li += '<div class="' + SECTION_NAV_TOOLTIP + ' fp-' + options.navigationPosition + '">' + tooltip + '</div>';
}
li += '</li>';
}
I don't see any problems here. You are using jQuery to manipulate DOM, so you should not care about plugins or whatever else.
<a id="linkA" href="xxx"></a>
<a id="linkB"></a>
var a = $('#linkA').attr("href");
var b = $('#linkB').attr('href', a);
console.log(b);
This sample will work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.