내 코드가 여기에 어떤 결과를 반환하지 않습니다 내가 원하는 결과를 반환하지 않습니다div의 html과 height & width를 추출하고 싶습니다.
var content = "<div id='content_dv'>";
content += "<table border='1' style='height:auto;width:auto;'>";
content += "<tr>";
content += "<td>";
content += "This is row 1";
content += "</td>";
content += "</tr>";
content += "<tr>";
content += "<td>";
content += "This is row 2";
content += "</td>";
content += "</tr>";
content += "<tr>";
content += "<td>";
content += "This is row 3";
content += "</td>";
content += "</tr>";
content += "</table>";
content += "</div>";
alert($(content).find('#content_dv').html());
alert("height "+$(content).find('#content_dv').height());
alert("width " + $(content).find('#content_dv').width());
내 콘텐츠 변수는 일부 html이 있고 div id라는 데이터를 "content_dv"라고 표시하고 싶습니다. 또한 높이 &를 결정해야합니다. div의 너비와 높이 & div의 내부 html의 너비.
제 코드가 작동하지 않는 이유를 알려주십시오. 내 코드에서 무슨 잘못이야. 덕분에
을 사용할 수 없습니까? 나는 몸에 추가하고 싶지 않다. 내가 사용하고 잘 작동하는 코드가 있습니다. 나는 여기에 코드를 제공하고있다. jQuery.ajax (type : "POST", url : "Login_LightFace.aspx/GetHtml", data : {}, contentType : "application/json; charset = utf-8", dataType : "json", 성공 : sHtml = data.d; modal.load (jQuery (sHtml) .find ('# frm') .html());} 오류 : function (XMLHttpRequest, textStatus, errorThrown) {alert (textStatus);}}); –
여기서 사용하는 .load() 메서드는 호출 한 html 요소에 데이터를로드합니다. 나의 예에서 이것은 간단한 예일 뿐이다. DOM에 새 구조를 추가하는 방법은 자유롭게 지정할 수 있습니다. [.load] (http://api.jquery.com/load/)에 대한 자세한 정보는이 부분을 참조하십시오. – herrlado