I have a string
var str = "edit_country"
I want to split words based on underscore and make one string "Edit Country" Here first letter after space should be capital.
I have a string
var str = "edit_country"
I want to split words based on underscore and make one string "Edit Country" Here first letter after space should be capital.
You Should try this.
var str = "edit_country";
str=str.split('_');
alert(str[0].charAt(0).toUpperCase()+str[0].slice(1));
alert(str[1].charAt(0).toUpperCase()+str[1].slice(1));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>