TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Paul Rajs
NA
641
147.1k
How to backspace and delete a string value using javascript
Apr 25 2020 7:36 AM
hi Developers ,
i am developing a login page . when enter password i have to backspace and delete the string value by getting keycode ... i have tried lot, still am not getting exact output
i have added my code on below , if anyone know kindly suggest me to done this module...
Html Code
<center>
<input type=text id='password'>
<input type="text" id="hdnPassword" name="hdnPassword" />
<div></div>
</center>
Javascript
<script src="Scripts/Plugins/jQuery/jquery-2.2.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var data = new Array();
$("#password").keypress(function (e) {
var char = String.fromCharCode(e.keyCode);
data.push(char);
var str = '';
for (i = 0; i < data.length; i++) {
str += data[i];
}
$("#hdnPassword").val(str);
document.addEventListener("keydown", KeyCheck); //or however you are calling your method
function KeyCheck(event) {
var KeyID = event.keyCode;
switch (KeyID) {
case 8:
// have to backspace the str value on this place
alert("backspace");
break;
case 46:
// have to delete the str value on this place
alert("delete");
break;
default:
break;
}
}
});
});
</script>
Thanking you
Regards
Paul.S
Reply
Answers (
2
)
How to get previous month/year in SQL Server
Access Rights Management