Hello,
Does anyone know of a way to automatically create ids for certain tags within Flare?
I'm working on adding a script to our documentation that allows users to click a button that will create and copy a link to a specific section of the page (similar to Chrome's new dynamic linking extension but not quite as advanced). The script uses the ids of h2 and h3 tags. We probably have nearly a thousand h2 and h3 tags that don't have ids. Doing this by hand will take for-e-ver!
Thanks!
Batch create / assign ids to <h2> and <h3> tags?
Re: Batch create / assign ids to <h2> and <h3> tags?
Just an FYI for anyone who is curious. I did not find a fast way to do this within Flare. But I did find a script that will add the ids when the page loads, which works just fine with the other script that I am using to create and copy links to specific sections of the webpage.
Code: Select all
var $headers = $('body h2, h3');
$headers.attr("id", function() {
return $(this)
.text() // get the h2, h3 text
.trim() // remove spaces from start and the end
.toLowerCase() // optional
.replace(/\s/g, '-'); // convert all spaces to dashes
});