2012-02-08 40 views
0

这里是jQuery代码。jQuery可调整大小的textarea不起作用

$('#textarea_introduce').resizable({ 
    helper : 'ui-state-highlight', 
    handles : 'se' 
}); 

和标记是

<div id="box_formIntroduce"> 
    <label for="textarea_introduce" id="label_introduce"> 
    <fmt:message bundle="${ resourceMessage }" key="label_introduce" /> 
    </label> 
    <textarea name="introduce" id="textarea_introduce" cols="20" rows="5"> 
    ${ resource.beforeValueMap.introduce } 
    </c:if> 
    </textarea> 
</div> 

这是行不通的。 我找不到任何错误... 这是什么问题?

测试环境:铬

+1

你说的“不完全工作”是什么意思? – karim79 2012-02-08 13:32:36

+1

检查控制台的错误,如果我还会建议你在Mozilla Firefox中测试,并看到萤火虫错误控制台并在这里发布这些错误 – Devjosh 2012-02-08 13:33:14

+1

有什么不工作呢? – 2012-02-08 13:33:53

回答

2

的我用你的一些代码,并在铬以下工作和IE8

<html> 
<head> 
<title></title> 

<script type='text/javascript' src='http://code.jquery.com/jquery-1.5.2.js'></script> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"></script> 

<link rel="stylesheet"  href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" 
type="text/css" media="all"> 

</head> 
<body> 
<div id="box_formIntroduce"> 
<label for="textarea_introduce" id="label_introduce"> 
</label> 
<textarea name="introduce" id="textarea_introduce" cols="20" rows="5"> 
</textarea> 
</div> 

<script type='text/javascript'> 
$(window).load(function(){ 
$("#textarea_introduce").resizable(); 
}); 
</script> 
</body> 
</html> 
+0

Thanks @Nicholas Murray !!!它的工作! – blim 2012-02-08 14:50:18

+0

很高兴帮助@blim - 不要忘记将其标记为公认的答案等等,等等,等等...... – 2012-02-08 15:53:41

0

如果您还没有这样做的话,我会把jQuery代码初始化在熟悉的文档加载代码.resizable(),只是为了确保有一个文本区域供调整:

$(document).ready(function(){ 
    $('#textarea_introduce').resizable({ 
     helper : 'ui-state-highlight', 
     handles : 'se' 
    }); 
}); 
+0

谢谢@Chris kempen。但它不起作用 – blim 2012-02-08 13:43:18

+0

您使用的是Chrome,对不对?点击F12,点击'console',然后刷新你的页面......出现什么错误? – 2012-02-08 13:48:47

+0

谢谢!我没有附加一个CSS文件。 – blim 2012-02-08 15:03:16