Solved

Jquery and checking for leading pound sign

Posted on 2013-05-31
3
415 Views
Last Modified: 2013-05-31
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
0
Comment
Question by:maccaj51
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39210492
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
 
LVL 9

Expert Comment

by:TvMpt
ID: 39210494
try:
inside blur event

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

}
0
 

Author Closing Comment

by:maccaj51
ID: 39210503
Always to the rescue leakim971! Many thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now