ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is the best html generator using Javascript and JQuery

I need to generate html on the client side depend on the ajax response. what is the best way to do that using Javascript and JQuery

user-image
تم إضافة السؤال من قبل Hazem Qannash , Technical Team Leader , Bayt.com
تاريخ النشر: 2012/12/09
Hazem Qannash
من قبل Hazem Qannash , Technical Team Leader , Bayt.com

I used Trimpath Template https://code.google.com/p/trimpath/wiki/JavaScriptTemplates It is very good templating engine to generate html content using javascript

Jose Ricardo Peteros
من قبل Jose Ricardo Peteros , Software Analyst Developer , Standard Chartered Bank

Maybe this one could help for you to start a new template.The templates are responsive already.Check this out.(http://www.initializr.com/)

Ashraf Sabry
من قبل Ashraf Sabry , Freelancer developer , N/A

I prefer using a templating engine rather than creating HTML manually.
There are many many libraries available, but my personal preference is Knockout templates (http://knockoutjs.com/documentation/template-binding.html), or otherwise Underscore templates (http://lodash.com/docs#template)

Fadi Alkhateeb
من قبل Fadi Alkhateeb , Senior Front End Developer , NexTwo

Well, there is many ways: 1.
Append(): $("p").append("Hi"); 2.
innerHTML: var newHTML = "this is in javascript"; document.getElementById('para').innerHTML = newHTML; 3.
createElement: $(document.createElement('div')) 4.
simply write something like $('div'), $('').
Depending on website i just checked : http://jsperf.com/jquery-vs-createelement, createElement seems to be the fastest way to generate html because of less time in proccess and jQuery doesn't have to identify it then create the element.

Nizar Ka
من قبل Nizar Ka , Senior Software Engineer , xerox

you can use Zen coding and if u want to use in visual studio, there is a plugin called "Web Essentials 2012"

 

Jonathan de Flaugergues
من قبل Jonathan de Flaugergues , software engineer , Abbeal

Get only the data with AJAX request, and bind html templates with this data. 

The best way is to use a javascript framework. 

You can try this with Backbone which easy to use and very popular.

Otherwhise, you can use Angular which is more complex but more efficient.

Muhammad Bilal Ahmed
من قبل Muhammad Bilal Ahmed , Senior Front End Developer , Seven Software Development

WYSIWYG Editor Easy to use : WYSIWYG editors allow novice Web developers to get up and running quickly.
Focused on Design: Most WYSIWYG editors allow the developer to focus more on how the page looks than on how the HTML looks.
This provides people with more creative room.
Specific Tasks Faster It is possible to do specific tasks much faster using a WYSIWYG editor than a text editor.
For example, tables can be created with most WYSIWYG editors using a visual layout of the table.
This is often much faster than typing out all the tags by hand.
Less Likely to Make Mistakes While most text editors include tag validation or integrate with a validator, if you don't use the tools, you can still write tables without end tags that won't display in Netscape.
WYSIWYG does the tags for you, so the only mistakes you'll make are in the design.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟