머리를 돌릴 수없는 문제가 있습니다. 다음 코드는 분명히 작동합니다.
$("#myspan").text("Some sample text");
어떤 이유로 내 범위 개체를 변수에 넣을 때 :
var myspan = $("#myspan");
다음 방법 중 어느 것도 작동하지 않습니다.
myspan.text("Some sample text");
myspan.innerHTML = "Some sample text";
myspan.val("Some sample text");
$(myspan).text("Some sample text");
다음 만 작동하지만 물론이 표기법이 마음에 들지 않습니다.
$(myspan.selector).text("Some sample text");
myspan.text () 함수를 사용할 수없는 이유를 누구든지 말해 줄 수 있습니까?
감사!
잘 작동합니다. 다음은 workig 바이올린 링크입니다. http://jsfiddle.net/3fGCx/1/
myspan.text("Some sample text");
$(myspan).text("Some sample text");
둘 다 괜찮을 것입니다. 아래는 작동하지 않습니다.
myspan.val("Some sample text");
여기에서의 value
속성 을 변경하려고합니다 span
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다