[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

[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 charlie.grie...@gmail.com wrote: $('#test').blur(function() {     $(this).val($(this).val().replace(/,/g,'')); }); You call it by telling jQuery to listen for the

[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. JQuery is completly new to me. OK how des the belo code look? script $(document).ready(function(){ $(#test').blur(function () { $('#test').val($('#test').val().replace(/,/g,'')); }); }); /script On Sep 29, 9:17 pm, Charlie Griefer charlie.grie...@gmail.com

[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? script

[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. script $(document).ready(function(){ $(input).blur(function () { $('#test').val($('#test').val().replace(/,/g,'')); }); }); /script On Sep 29, 9:42 pm, Charlie Griefer charlie.grie...@gmail.com wrote: Because it's completely new to

[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, Sep

[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

[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 RobG
On Sep 30, 6:27 am, factoringcompare.com firstfacto...@googlemail.com wrote: Thank you. JQuery is completly new to me. OK how des the belo code look? script   $(document).ready(function(){     $(#test').blur(function () {          $('#test').val($('#test').val().replace(/,/g,'')); You