sideroad

jQuery Render Plugin

jQueryRender Plugin is Render html by template and JavaScript Object.

Dual licensed under the MIT or GPL Version 2 licenses.

Requires jQuery

Supported Browser : IE 7.x or upper, Firefox 3.x or upper, Google Chrome2.x or upper

Usage

// Use String template         
$(elem).render(
"${name} is running!", 
{ name : "sideroad" }
); 

// Get template by ajax
$(elem).render(
{ url : "http://sideroad.secret.jp/plugins/jQueryRender/test.ren" }, 
{ name : "sideroad" }
);

//Set word file. this setting used by user language. $w{} is replaced by word setting files.
$(elem).word(
{ en : "word.en", ja : "word.ja" }
);

// Set suffix for ajax template
$(elem).renderSuffix(
{ ".ip" : /iPhone/, ".an" : /Android/ }
);
if you want more information. see QUnit on github.jQuery Render's QUnit on github.

Demo

var obj = {
message:"Hello World!", 
title:"jQuery plugin", 
plugins:["jquery.sidebar","jquery.textanimation","jquery.floatingmessage"],
fruits : [
{name : "Apple", amount : 10},
{name : "Grape", amount : 20},
{name : "Lemon", amount : 30}
]
};

var ajaxOptions = {
type : "POST",
success : function(){
$("#re4").append("finished");
}
};

$("#re1").render("
${message}
",obj); $("#re2").render("
${title}
",obj); $("#re3").render("
  • $val
",obj); $("#re4").render("

$key is $val

",obj); $("#re5").render("
  • ${name} is Apple
  • ${amount} is 10
",obj); $("#re6").render("test.ren",obj,ajaxOptions);

Download

Downloadgithub

Comment