I am using jQuery to dynamically insert combo buttons in a loop. Right now I have the tag successfully getting added, but I also want a line break (<br/>) after each one. How can I accomplish this? Here is what I have so far:
var input = $('<input>', {
type: "radio",
开发者_开发问答 name: "phone-format-radio",
value: i+1,
text: GetDisplayNumber( format )
});
$(id + ' > button').before( input );
the 'id' variable is the ID of my <section> element which contains my dynamically created <input> elements. There is also a <button> element inside of my <section> that is defined in the HTML file and must always remain the last child in my <section> (which is why I use .before().
You can simply use after:
input.after('<br/>');
加载中,请稍侯......
精彩评论