Using custom type attribute in [removed] tags such as jQuery's text/x-jquery-tmpl

前端 未结 2 1418
执笔经年
执笔经年 2020-12-29 07:56

I noticed that jquery\'s beta template plugin is using, the type attribute \"text/x-jquery-tmpl\"

e.g



        
2条回答
  •  孤城傲影
    2020-12-29 08:34

    The type actually does indicate what sort of script is there. If the browser doesn't understand it, it should ignore it. In this case, it's a convenient and semantic sort of way to include the source of the template without displaying it on the screen.

    Usually with jquery template, you'll give it an id and refer to it that way with your $(id).tmpl call.

    script def here: http://www.w3.org/TR/html401/interact/scripts.html#idx-scripting_language

    examples of tmpl here: http://api.jquery.com/tmpl/

提交回复
热议问题