I want to add a string at the end of a jquery object. Something like this:
var mytable = $("<table><tbody><tr><td>");
mytable.after("Test</td></tr></tbody></table>");
I tried with that too
mytable += "Test</td></tr></tbody></table>";
Doesn’t work either.
jQuery doesn’t work that way. When you’re dealing with elements in jQuery they are always valid. If it can’t validate it, it won’t add it. I tried your example and jQuery completed the invalid HTML:
If you’re looking to add a new cell to your table, you could select the required element (i.e. the
tr) and then use the append methodOf course, you can add two strings together and put them in a jQuery object as long as they join to make valid HTML