hi i am trying to implement the delete and back space using javascript,the problem i am facing is whenever i hit the delete button it starts deleting from the end instead of the current cursor position and continues like backspace after that till the end. the code for delete is below:
case "btnDel": // ID of button
{
try
{
var temp="";
if (document.getElementById("txtSearch").value.length>0)
{
document.getElementById("txtSearch").value=document.getElementById("txtSearch").value.substring(0,document.getElementById("txtSearch").value.length-1);
}
}
code for bank space:
case "btnBackSpace":
{
try
{
var temp="";
if (document.getElementById("txtSearch").value.length>0)
{
document.getElementById("txtSearch").value=document.getElementById("txtSearch").value.substring(0,document.getElementById("txtSearch").value.length-1);
}
can anyone please help me to achieve my goal of implementing the back space and delete in the true sense!!
thank you!!