2012-02-08 61 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