insert hyphen using jquery

Posted by Klbaiju under jQuery on 7/26/2013 | Points: 10 | Views : 2043 | Status : [Member] | Replies : 1
Hi,
I want to add a hyphen inside a string using jquery
i tried this
var id=10 jun 2013
var nid = id.replace('', '-');
i got the result as -10 jun 2013

i need output as 10-jun-2013.

Regards
Baiju




Responses

Posted by: Bandi on: 7/26/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
You can do like this...
<script type="text/javascript">
$('identifier').value = $('identifier').value.toLowerCase().replace(' ', '-');
</script>

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response