What is the most efficient way to create HTML elements using jQuery?

后端 未结 12 2665
甜味超标
甜味超标 2020-11-22 06:40

Recently I\'ve been doing a lot of modal window pop-ups and what not, for which I used jQuery. The method that I used to create the new elements on the page has overwhelming

12条回答
  •  暖寄归人
    2020-11-22 07:10

    I am using jquery.min v2.0.3 . It's for me better to use following:

    var select = jQuery("#selecter");
    jQuery("`

    as following:

    var select = jQuery("#selecter");
    jQuery(document.createElement('option')).prop({value: someValue, text: someText}).appendTo(select);
    

    Processing time of first code is much lower than second code.

提交回复
热议问题