CodeMirror textarea.getAttribute is not a function error in mvc3 application

三世轮回 提交于 2019-12-01 04:05:27
Mohamed Talha Elsayed

You need to use document.getElementById() instead of the jQuery lookup.

Sprotty
document.getElementById('contents'); //returns a HTML DOM Object

var contents = $('#contents');  //returns a jQuery Object

In jQuery, to get the same result as document.getElementById(), you can access the jQuery Object and get the first element in the object (Remember JavaScript objects act similar to associative arrays).

var contents = $('#contents')[0]; //returns a HTML DOM Object
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!