I'm not sure how necessary this is, and it adds a call to getElementById
, but if you're really keen on getting inline JavaScript out of your code, you can pass it as an HTML attribute, namely:
And then in your JavaScript:
var size_of_widget = document.getElementById("metadata-size-of-widget").title;