javascript - jquery get html from custom elements without closing tag -
javascript - jquery get html from custom elements without closing tag -
i define custome html elements below:
<div class="test"> <myelement1 class="elclass" /> <myelement2 class="elclass" > <myelement3 class="elclass"> html </myelement3> </div> and html of them jquery code:
var elementhtml = ""; $('.test').find(".elclass").each(function(){elementhtml += "my element html: " + $(this).html();}); alert(elementhtml); it works fine myelement3 it's not work myelement1 , myelement2. how html myelement1 , myelement2? know if works fine, html of myelement1 , myelement2 null.
update:
i know myelement2 not standard in html there elements myelement1 , myelement2. example: <input> can write <input/>, <img> or <img/>. want create custom elements in 3 types:
1.<tagname> 2.<tagname/> 3.<tagname></tagname> i know myelement1 , myelement2 html empty want html them. there way html of above types of custom elements?
you forgot close myelement2.
also myelement1 , myelement2 html empty
javascript jquery html tags
Comments
Post a Comment