javascript関数を使用して値を追加しています.... onkeypressイベントを使用すると、スラッシュ(/)が与えられたときに値が警告メッセージとともに正しく追加されます。 ..but iの値が配列に正しく追加取得されていないonpasteイベントを使用する場合....誰かがこのonpasteイベントが正しく機能していない
function onlyAlphabets(e, t) {
\t try {
if (window.event) {
var charCode = window.event.keyCode;
}
else if (e) {
var charCode = e.which;
}
else { return true; }
if ((charCode == 47)){
\t
\t alert("Please use any other charachter! ");
return false;
}
else{
return true;
}
}
catch (err) {
alert(err.Description);
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div class="table-responsive">
<table class="table table-striped table-bordered table-fixed table-hover table-condensed" id='+tables+' onkeypress="return onlyAlphabets()" >
<thead>
<tr><th></th><th>Code</th><th>Sub Category</th></tr>
</thead>
<tbody class="tbody"></tbody>
</table>
</div>';
あなたが持っている場合は... else if ... else'後で何も実行されません... – alfasin
あなたはどこでペーストイベントを聞きますか?ペーストイベントでやっている?何が動作しません。 – Kaiido
私はonpasteを使用している場合keypressイベントを使用していない.... that doesnt work – usr