I am trying to create an anchor with jQuery using some custom HTML5 attributes to get something like this.
$('<a/>', {href : "#local_anchor",text: "DUMMY_TOKEN", onClick:"remote_function('token')"}).attr("data-toggle", "modal")
If I use this code, it works fine.
$('<a/>', { href : "#local_anchor", text: "DUMMY_TOKEN", onClick:"remote_function('token')" }).attr("data-toggle", "modal")
But I would like to pass the data as a parameter on the first href, text, etc. When I try to do this, I get a syntax error.
I also tried using .data (), but I could not set the value in the markup only in the DOM.
source share