Click here to Skip to main content
16,009,728 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in mvc4, i have textbox for a skills when one skill add and give space then auto put Comma.

@Html.TextBoxFor(model => model.strSkills, new { @maxlength = "50", @class = "TextField Skills", placeholder = "Enter Person Skills" })
Posted
Updated 3-Jan-16 22:08pm
v2

$('#strSkills').keyup(function () {
var input = $("#strSkills").val();
var output = input.split(" ").join(',');

$('#strSkills').val(output);
 
Share this answer
 
This can be done easily using some JavaScript.
Then replace the space with a comma.

On keypress check if a space is entered -
$(textbox.bind('keyup', 'space', function () {
      replace( /(?!\s+$)\s+/g, ", " );
});
 
Share this answer
 
Comments
AnantPithadiya 4-Jan-16 4:26am    
Hello Abhinav,
this is not working..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900