I'm trying to find a "best" method for dynamically loading files, and other elements by using the new html 5 "data-" attribute for storage and then removing it when needed.
My Question:
How do I target the "data-" attribute and remove it thus leaving the remaining attribute name?
For example, this:
<!-- Custom CSS -->
<link rel="stylesheet" class="custom" data-href="css/mobile.css">
Would turn into this:
<!-- Custom CSS -->
<link rel="stylesheet" class="custom" href="css/mobile.css">
Edit: This entire experiment is for Responsive Design (ui/performance), I need to be able to load css files/ elements depending on device resolution. This will result in higher performance for smaller devices to prevent unnecessary data loading. I'm using enquire.js plugin (amazing btw), which allows you to have functions fire off when a media query is targeted. So in an effort to stay current I wanted to use the "data-" attribute to add/remove elements from the DOM depending on device resolution.
This tutorial by Christian Heilmann does just this: http://christianheilmann.com/2012/12/19/conditional-loading-of-resources-with-mediaqueries/
I'm trying to combine his technique with enquire.js