殘疾人按鈕,我有這樣的代碼(doc):使用jQuery移動
<!DOCTYPE html>
<html>
<head>
<title>123</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
</head>
<body>
<form>
<input type="text" name="comment" id="comment" placeholder="Comment" maxlength="140" value="">
<div id="charactersLeft"></div>
<input type="submit" id="commentButton" data-icon="edit" data-inline="true" data-mini="true" data-theme="b" value="Send" disabled="disabled">
</form>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<script src="http://zurb.com/playground/javascripts/plugins/jquery.textchange.min.js"></script>
<script>
$(document).ready(function(){
$('#comment').bind('hastext', function() {
$('#commentButton').removeAttr('disabled');
});
$('#comment').bind('notext', function() {
$('#commentButton').attr('disabled', 'disabled');
});
$('#comment').bind('textchange', function (event, previousText) {
$('#charactersLeft').html(140 - parseInt($(this).val().length));
});
});
</script>
</body>
</html>
如果我刪除了CSS,這個工程。
在Chrome的控制檯:
$('#commentButton');
<input type="submit" id="commentButton" data-icon="edit" data-inline="true" data-theme="b" value="Отправить" disabled="disabled" class="ui-btn-hidden" data-disabled="true">
它很奇怪,因爲在HTML我還沒有得到class="ui-btn-hidden"
。所以,我可以在<script>
中進行一些更改:
$('#comment').bind('hastext', function() {
$('#commentButton').removeClass('ui-btn-hidden').removeAttr('disabled');
});
然後apears +1按鈕!看起來像「風格衝突」,因爲沒有CSS一切正常!
如何解決這個問題?謝謝。
可以爲此提供一個小提琴。 – vipulsharma
http://jsfiddle.net/kfDHh/嘗試在表單中寫入內容,然後刪除css並重試 – tim