开发者

jquery autogrow

I know that combining two framework prototype and jquery is not a good idea. But I already a lot of code made by prototype, But when I discovered jquery I decided to use this because there is some methods and functions advances than prototype.

My question is I was using jquery autogrow but it was not work if I am using prototype at the same time. Even I was followed the jquery instructions regarding "using jquery with other libraries"

any help would greatly appreciated

in the head

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>开发者_如何学Python;
<script type="text/javascript" src="js/jquery.autogrow.js"></script>
<script> 
jQuery.noConflict()
jQuery(document).ready (function() {

jQuery('#expanding').autogrow({
    maxHeight: 100,
    minHeight: 30,
    lineHeight: 16
});

});
</script>

in the body

<body>
    <textarea name="" cols="50" rows="" id="expanding"></textarea>
</body>


I'm assuming you have the latest version of autogrow from http://plugins.jquery.com/project/autogrow. There is a minor bug in that version that prevents it from working when you're using prototype. It's simple fix; the error is on line 103 of jquery.autogrow.js

You need to change:

if ($.browser.msie)

to:

if (jQuery.browser.msie)

Your code should work once you fix that.

P.S. Please remember to add comments or edit your question, when appropriate, instead of adding an answer - the 'answer' you just added is not technically an answer.


For starters, you should always use the type attribute with <script> tags. You should make sure you end each line with a semicolon ;)

<script type="text/javascript"> 
jQuery.noConflict();


Try including prototype after jquery and jquery.autogrow in your sequence of script includes.


I solved it by changing the css padding and line-height:

textarea {
  padding:4px;
  font-size:12px;
  line-height:14px
}

this one works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜