tags:

views:

31

answers:

1

I have the following code, in which jGrow is not working. I have included Javascript jGrow file. Textarea doesn't adjusts its size according to lengtht of text, instead a scrollbar appears in textarea

<html><head>
<title>jGrow</title>
<script src="jquery.js" type="text/javascript"></script>
<script src="jgrow.js" type="text/javascript"></script>
<script type="text/javascript">
$("textarea#sample1").jGrow({
max_height: "300px"
});
</script>
</head>


<body>
<form>
<textarea id="sample1">Jgrow</textarea>
<input type="submit">
</form>
</body>

</html>   
+1  A: 

Have you tried debugging with for example Firebux in Firefox? I suspect jGrow hasn't been loaded yet before you are calling it. Solution is to wrap your call into $(document).ready(function() {/* your code */});

<html><head>
<title>jGrow</title>
<script src="jquery.js" type="text/javascript"></script>
<script src="jgrow.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("textarea#sample1").jGrow({
    max_height: "300px"
    });
});
</script>
</head>


<body>
<form>
<textarea id="sample1">Jgrow</textarea>
<input type="submit">
</form>
</body>

</html>  
PoweRoy
i have wrapped my call into $(document).ready(function() {});, but still it is not working. When i clicked on respective jgrow.js from firebug it is not displaying anything, what may be the problem???
Does jgrow.js have an (error)code next to it in firebug? 200 is ok anything else means something wrong
PoweRoy
No, it does not have any number next to it that means it is loaded properly??
Are you looking at the right page? You should look for the 'Net' tab. Each file downloaded has a status (code) and it should be 200(ok) or 304(not modified).
PoweRoy