jquery,template,user,control,js

Kubilay 8/10/2016 1people says helpful

Using jQuery Templates This sample code demonstrates how to use jquery templates as user controls in js. You need to reference jquery.tmpl

Html
<script id="imageTemplate" type="text/html">
    <p id="{{= Id }}" data-id="{{= Filename }}" data-type="image" data-src="{{= ImagePath }}" class="image-main jsExpImage" style="text-align: center;">
        <img class="delete-image" data-id="{{= Filename }}" style="display: none;" src="/images/main/delete_icon.png" />
        <img id="{{= Filename }}" class="img graf-image jsExpImg" style="display: block;width:100%;" src="{{= ImagePath }}" alt="{{= Filename }}" />
    </p>
</script> 
JavaScript
 var rnd = parseInt(Math.random() * 1000000);

 var expImage = {};
 expImage.Id = "image"   rnd;
 expImage.ImagePath = e.publicUrl;
 expImage.Filename = e.fileNewName;

 $('#imageTemplate').render(expImage).appendTo("#inputExperience"); 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments