How can I pass a string variable from HTML to javascript with spaces?
For instance, I have the following:
<a data-toggle="tab" data-productname="Testing Name"></a>
When I access the productname attribute in javascript, only "Testing" shows up. I tried to escape the variable with:
<a data-toggle="tab" data-productname=<%= j "Testing Name" %>></a>
But that still doesn't work. What can I do here?
$('[data-productname]').data('productname')will return "Testing Name" (with a space).