0

I have this nested, Bootstrapped accordion where the collapsing is done by setting the element href's as "#collapseOne", "#collapseTwo" and so on.

On my page, when user clicks a link on the accordion the page also loads the content as specified by the anchors "data-guid" attribute such as:

//HTML
<a href="#collapseOne" data-guid="Cats">Click to fill page with cats</a>

$(".link_to_click").on("click", function(){
    var guid = $(this).data("guid") // cats
    loadContent(guid) // loads cats to page
});

I want to bookmark this page by dragging the link to the bookmarks toolbar (Firefox) and I get this

Cats

When I'd like the location to be www.catsforall.com/index.html?guid=cats

If I try to change the href when starting the drag

$(".link_to_click").on("dragstart", function(){
   $(this).prop("href", "www.catsforall.com/index.html?guid="+$(this).data("guid"));
});

it still bookmarks the original href even though it changes the href in the element and the dragend event also says it has been changed.

$(".link_to_click").on("dragend", function(){
   console.log($(this).prop("href")); // www.catsforall.com/index.html?guid=cats
});

I have also been trying to change "pathName"-property and tried to fiddle with event.originalEvent.dataTransfer objects with no luck. Any ideas?

Pete TNT
  • 8,293
  • 4
  • 36
  • 45

1 Answers1

0

When you Drag and Drop something, you dont move or alter The original object. A copy is written down is the buffer.

As Im no expert id try the following:

event.dataTransfer.getData()
event.dataTransfer.setData()
jungerislaender
  • 304
  • 1
  • 12