can you please tell me how to replace space to underscore at same time (when i enter the text in input field)? If I have string I used like that.
replace(/ /g,"_");
But I am looking for when user enter text on input field then It automatically replace the space with underscore .I used keyup event it only fire first time.
$("#test").keyup(function() {
var textValue = $(this).val();
if(textValue==' '){
alert("hh");
}
});
ALTER TABLE table_name ADD duplicate_column_name VARCHAR(255) AFTER column_name; UPDATE table_name SET duplicate_column_name = LOWER(REPLACE(column_name, ' ', '_')); Just be sure to update the data-type in the ALTER command to reflect your actual data-type. Save this answer.
Select the range of cells where you want to replace spaces (B2:B7), and in the Menu, go to Edit > Find and replace (or use the keyboard shortcut CTRL + H). 2. In the pop-up window, (1) enter space in the Find box and (2) underscore (_) in the Replace with box. The, (3) click Replace All and (4) Done.
1) Change the format for ALL cells on a sheet to TEXT. 2) Put 1_1_1 in cell A1 and 20_20_20 in cell B1. 3) Search and Replace "_" with "-" (replace hyphen with a dash).
DEMO
$("#test").keyup(function () {
var textValue = $(this).val();
textValue =textValue.replace(/ /g,"_");
$(this).val(textValue);
});
Update
DEMO
$("#test").keyup(function () {
this.value = this.value.replace(/ /g, "_");
});
Simply try this Demo
$("#test").keyup(function() {
if ($(this).val().match(/[ ]/g, "") != null) {
$(this).val($(this).val().replace(/[ ]/g, "_"));
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With