Jquery and checking for leading pound sign

Hello experts,

is there any way of making sure than an input has a £ sign at the start on blur? without using a plugin?

Many thanks in advance
maccaj51Asked:
Who is Participating?
 
leakim971PluritechnicianCommented:
Test page : http://jsfiddle.net/dfzqD/
$(document).ready(function() {
     $("#inputID").blur(function() {
            var value = "£" + $(this).val().replace(/£/g,"");
            $(this).val(value);
     })
})

Open in new window

0
 
TvMptCommented:
try:
inside blur event

if (string_var_from_input.match(/^£/) != null) {

}
0
 
maccaj51Author Commented:
Always to the rescue leakim971! Many thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.