var content = '<h2>SomeText</h2><input id="trapName" />'; var xx = $(content).find('#trapName');>>It's a standalone fragment - not associated (and cannot be) with the main DOM (which, I believe, is the default context for JQuery).
>>>$(document).ready(function () { >>> $(":input[data-autocomplete]").each(function () { >>> $(this).autocomplete({ source: $(this).attr("data-autocomplete") }); >>> }); >>> >>> $("form div input").focus(function () { >>> >>> $("form div").each(function () { >>> $(this).css("background-color", "white"); >>> }); >>> >>> $(this).parent().css("background-color", "#F2FAED"); >>> $(this).select(); >>> $('.SelectOnEntry').focusin(function () { >>> $(this).select(); >>> }); >>> }); >>> >>> $("input:text") >>> .focus(function () { $(this).select(); }) >>> .mouseup(function (e) { e.preventDefault(); }); >>>}); >>>>>>
$(content): jQuery.fn.jQuery.init[3] >>>>>>0: h2 >>>>>>1: text >>>>>>2: input#trapName >>>>>>length: 3 >>>>>>__proto__: Object[0]so I thought I could access the input element with
$(content).find('#trapName')but it finds nothing.