This script returns a value like 33 | 4 and I need only the the first whole number, in this case 33.
Can I use .replace( /[^\d].*/, '' ) and where/how to put this? Or is there better solutions?
You are all very helpful, but i'm in a stage where I need to see my full script or a line from it with you solutions implemented ;-)
Thanks
jQuery(document).ready(function($) { $("#input_1_1").blur(function() { // sets the value of #input_1_8 to // that which was entered in #input_1_1 $("#input_1_8").val($("#input_1_1").val()); }); });
parseInt()on the value. It will read all leading digits until a non-digit character is found: jsfiddle.net/c27xfdohstr.split(/\D+/)[0]"33 | 4".split('|').map(a=> trim(a))[0]