Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Простой метод, позволяет создавать теги как с помощью рельсового метода `content_tag`
var content_tag;
content_tag = function(tag, content, params){
var tag, content, params, res;
var insert_params = '';
for(var key in params){
insert_params += ' '+key+'='+'"'+params[key]+'"';
}
if(content){
res = '<'+tag+insert_params+'>'+content+'</'+tag+'>';
} else {
res = '<'+tag+insert_params+'/>';
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment