I'm trying to create a button that when pressed will remove the last character entered in a text field called "cell" using jQuery.
Here is what I have:
$("#cell").value($("#cell").substring(0, $("#cell").length() - 1);
It doesn't work Can someone shed some light on what I'm doing wrong.
To get or set values of text fields with jQuery you should use .val().
Untested, but something like the following should work:
var el = $("#cell");
var the_value = el.val();
the_value = the_value.substring(0, the_value.length - 1);
I've split the code into several steps to show what's going on.
That worked perfectly. Thank you very much!