我正在使用 jquery 字符计数器并将其与 Codeigniter 中的表单助手集成。我已经让一切正常工作,但是当我使用这个脚本时,括号没有出现。我输入了它们并使用了 ascii 代码,它们只有在我取下脚本时才会出现。
知道这可能是什么吗?
提前致谢。
javascript:
<script>
function updateCountdown_mylife() {
var remaining = 1340 - jQuery('.message_mylife').val().length;
jQuery('#mylife').text(remaining + ' characters remaining.');
}
jQuery(document).ready(function($) {
updateCountdown_mylife();
$('.message_mylife').change(updateCountdown_mylife);
$('.message_mylife').keyup(updateCountdown_mylife);
});
function updateCountdown_occupation() {
var remaining = 200 - jQuery('.message_occupation').val().length;
jQuery('#occupation').text(remaining + ' characters remaining.');
}
jQuery(document).ready(function($) {
updateCountdown_occupation();
$('.message_occupation').change(updateCountdown_occupation);
$('.message_occupation').keyup(updateCountdown_occupation);
});
</script>
html:
My Life <br /><span class="title_sub_text">Tell us a about yourself</span> <span class="edit_sub_text" id="mylife">(1350 character limit)</span>
文本区域:
<div class="edit_text_area">
<?php
if(empty($user['mylife']))
{
$data = array('name' => 'mylife', 'class' => 'message_mylife');
echo form_textarea($data);
}
else
{
$data = array('name' => 'mylife', 'class' => 'message_mylife');
echo form_textarea($data, $user['mylife']);
}
?>
</div>
提前比