CodeMirror textarea.getAttribute mvc3

I m using codemirror in my ASP.NET MVC 3 application, codemirror ​​(2.34)

my TextArea :

@Html.TextAreaFieldFor(s => s.Data.CodeBehind, htmlAttributes: new Dictionary<string, object> { { "class", "textbox codeBehind nffp-code" } })

codemirror :

var a = CodeMirror.fromTextArea($code, {
        lineNumbers: true,
        matchBrackets: true,
        mode: "text/x-csharp"
});

$code

var $code = jQuery('.nffp-code', $root);

:

TypeError: textarea.getAttribute codemirror.js 2209 textarea.getAttribute( "" )!= null && & & hasFocus == document.body;

codemirror:

, m a total noob in JS, I guess it , .

, ?

+5
2

document.getElementById() jQuery

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

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

jQuery, , document.getElementById, jQuery (, JavaScript ).

var contents = $('#contents')[0]; //returns a HTML DOM Object
+1

All Articles