Created
October 14, 2012 14:15
-
-
Save achempion/3888703 to your computer and use it in GitHub Desktop.
Простой метод, позволяет создавать теги как с помощью рельсового метода `content_tag`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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