Dor Eliyahu Dor Eliyahu - 6 months ago 17
HTML Question

cannot add line of "row numbers" in textarea

I tried to add to textarea a line of the row numbers with this example:
http://alan.blog-city.com/jquerylinedtextarea.htm

this is my code and I allready use the css and js in my project:

<!DOCTYPE html>
<html>
<head>
<title>CODE</title>
<link href="jquery-linedtextarea.css" rel="stylesheet">
<script src="jquery-linedtextarea.js"></script>
</head>
<body>
<textarea class="lined" name="mytext"></textarea>
<script>
$(function () {
$(".lined").linedtextarea(
{ selectedLine: 1 }
);
$("mytext").linedtextarea();
});
</script>
</body>
</html>


what I wrong ?

Answer

It seems you forget to call Jquery Library...

Just add the code below on your <head>:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> </script>

And I believe you should delete that part:

$("mytext").linedtextarea();

I've made a code. It works for me. Check it out...

<html>
<head>
	<title>JQuery LinedTextArea Demo</title>
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
	<script src="http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.js"></script>
	<link href="http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.css" type="text/css" rel="stylesheet" />
</head>
<body>

<h1>JQuery LinedTextArea Demo</h1>

<p>Add a scrollable lined area to a standard TextArea control.</p>

<textarea class="lined" rows="10" cols="60">
JavaScript was originally developed by Brendan 
Eich of Netscape under the name Mocha, 
which was later renamed to LiveScript, 
and finally to JavaScript. 

The change of name from LiveScript to JavaScript roughly 
coincided with Netscape adding support for 
Java technology in its Netscape Navigator 
web browser.    

</textarea>

<script>
$(function() {
	$(".lined").linedtextarea(
		{selectedLine: 1}
	);
});
</script>


</body>
</html>

Comments