Is there a way to trim the input text down to just the first two characters when a button is clicked?
For example, if I enter "BT2J43" into the input field, can it be automatically shortened to "BT" upon clicking the button?
I'm new to learning jQuery and would appreciate some guidance. Here is my fiddle link:
https://jsfiddle.net/ktd9gbu9/1/
$("#submit123").click(function() {
$("#text123").text($("#text123")[0].innerText.substr(2));
});
<input type="search" name="table_filter" id="text123" required>
<input name="submit" type="Submit" id="submit123" value="Search">