I have this html page I copied from here. There is a javascript used that changes text areas into rich text editors. It works like it should when I just copy it in a file and open it with a browser. However, when I try to put it in my c# project and put it in a cshtml file (without changing anything) it ignores(?) the javascript and shows the textareas as plain textareas. How can I make this work in cshtml?
The code, same in html page as cshtml page:
<div id="sample">
<script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script>
<script type="text/javascript">
//<![CDATA[
bkLib.onDomLoaded(function () { nicEditors.allTextAreas() });
//]]>
</script>
<h4>
First Textarea
</h4>
<textarea name="area1" cols="35">
</textarea><br />
<h4>
Second Textarea
</h4>
<textarea name="area2" style="width: 100%;">
Some Initial Content was in this textarea
</textarea><br />
<h4>
Third Textarea
</h4>
<textarea name="area3" style="width: 300px; height: 100px;">
HTML content default in textarea
</textarea>
</div>
When you copied and pasted the code into your cshtml, did you reference their copy of the nicEdit-latest.js file, or did you save a local copy of it.
As far as I can see it should work if you copied the HTML over exactly the way they have it.
try using the following if you are referencing a local copy of the js file
EDIT
This should work.
Add a reference Jquery to if you haven’t yet, and modify the code to look like this
jsfiddle example