Skip to content

Instantly share code, notes, and snippets.

@nyaahara
Created June 25, 2014 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyaahara/4ce15bb88482a794fe1f to your computer and use it in GitHub Desktop.
Save nyaahara/4ce15bb88482a794fe1f to your computer and use it in GitHub Desktop.
var initial_values = link.attributes['initial_values']; // Initial value ( format JSON )
// Add initial value.
initial_values = (initial_values)?JSON.parse('{'+initial_values.value+'}'):'';
for(var key in initial_values){
var pattern = '['+key+']"';
content = content.replace(pattern, pattern+' value="'+initial_values[key]+'"');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment