//Kevin Rodríguez - Costa Rica - 2015
//Jquery 1.7+
//Spanish: Usando Jquery llamamos a la función isNumeric()
// para saber si el contenido no es numérico, y si es así
// se eliminan las ocurrencias de caracteres que no estén entre
// 0 y 9 usando una expresión regular.
//English: Using Jquery we call the isNumeric() function
// to know if the given variable is numeric, if not then every
// character occurrence is removed by using a regular expression.
var Content = "200FF!";
if (!$.isNumeric(Content)) Content = Content.replace(/([^0-9])/g, "");
alert(Content);
//The result is 200
//El Resultado es 200
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.