Yakup K
asked on
pass the previous tr td content into the link href
I had this question after viewing Adding a link on the nested data table.
I would like to pass the the department name into the export link, which I have created in drawcallback
So the link should be like that;
Any helps would be really appricated.
Thanks
JSFiddle
I would like to pass the the department name into the export link, which I have created in drawcallback
So the link should be like that;
$(".export").on("click", function(){
console.log("button is clicked");
$(this).attr("href", "departmentName={departmentName}");
});
<a class="export" href="#" target="_blank">Export</a>
href= should be the parent first td ( department name)
Any helps would be really appricated.
Thanks
JSFiddle
ASKER
Thanks for your comment Chris. Unfortunately, this is taking the next tr td content.
I would like to get the previous tr and second td ( Which is department name) .
This is the output for your script.
Export departmentsSearch:namephon ehire_date idOrigenes Maxwell345892February 1, 20046234Previous1Next
Please see the jsfiddle
I would like to get the previous tr and second td ( Which is department name) .
This is the output for your script.
Export departmentsSearch:namephon
Please see the jsfiddle
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Chris. This one works perfectly.
No worries. Glad I could help
ASKER
Hi Chris, When I click on the pagination, It duplicated the anchor links. For example, if there are 4 pages it duplicates the link for 4 times. Any ideas on this ?
Not sure about that. It seems like it's a completely different issue to the one raised in this question, and is probably more about how you're creating the data in the first place.
It makes sense to open a new question to ask about that specific problem
It makes sense to open a new question to ask about that specific problem
Open in new window