[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread RobG
On Sep 30, 6:27 am, "factoringcompare.com" wrote: > Thank you. JQuery is completly new to me. OK how des the belo code > look? > >

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread James
It'll be good practice when you start to use $(this) inside the callback function. Here's essentially the same thing: $(document).ready(function(){ $("#test").blur(function () { // here, $(this) is a reference to $("#test") $(this).val( $(this).val().replace(/,/g,'') ); }

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread factoringcompare.com
Great advice and assistance got me looking in the right direction. Thank you. Got this code working: $(document).ready(function(){ $("# test").blur(function () { $('#test').val($('#test').val().replace(/,/g,'')); }); }); On Sep 29, 9:58 pm, Charlie Griefer wrote: > Works fo

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread Charlie Griefer
Works for me. Bear in mind you're selecting every input on the page by virtue of $('input'). Bear in mind further that on blur for every input, you're telling jquery to remove the commas from the element with id="test" (by virtue of $('#test'). Do you have an element with id="test" ? On Tue, Se

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread factoringcompare.com
No it doesn’t work. I’ll work it out. $(document).ready(function(){ $("input").blur(function () { $('#test').val($('#test').val().replace(/,/g,'')); }); }); On Sep 29, 9:42 pm, Charlie Griefer wrote: > Because it's completely new to you is exactly why you should be re

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread Charlie Griefer
Because it's completely new to you is exactly why you should be reading the docs :) Does the code below run? On Tue, Sep 29, 2009 at 1:27 PM, factoringcompare.com < firstfacto...@googlemail.com> wrote: > > Thank you. JQuery is completly new to me. OK how des the belo code > look? > > > > $(doc

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread factoringcompare.com
Thank you. JQuery is completly new to me. OK how des the belo code look? $(document).ready(function(){ $("#test'").blur(function () { $('#test').val($('#test').val().replace(/,/g,'')); }); }); On Sep 29, 9:17 pm, Charlie Griefer wrote: > jQuery is based on "find som

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread Charlie Griefer
jQuery is based on "find something -> do something". The "find something" is largely done with selectors (similar to CSS selectors). you want to find the element with the id="test". that would be $('#test') you want it to do something when that element receives a blur event... $('#test').blur(

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread factoringcompare.com
Thank you. Could you elaborate on the code so that I can track it through and understand On Sep 29, 8:49 pm, Charlie Griefer wrote: > $('#test').blur(function() { >     $(this).val($(this).val().replace(/,/g,'')); > > }); > > You "call" it by telling jQuery to "listen" for the blur() event on th

[jQuery] Re: Strip out all of the commas in numeric text field

2009-09-29 Thread Charlie Griefer
$('#test').blur(function() { $(this).val($(this).val().replace(/,/g,'')); }); You "call" it by telling jQuery to "listen" for the blur() event on the element with id="test" (line 1 above). Your code was correct, but you can replace the $('input#test') with $(this), since $(this) will be a ref