JavaScript input Property
Definition and Usage
The input property is the string the pattern match is performed.Syntax
RegExp.input |
Example
In the following example we will get the input string the regular expression vas performed on:<script type="text/javascript"> function getRegInput() { var patt1 = new RegExp("W3"); var str = document.frm1.txtinput.value; patt1.test(str); if(RegExp.input) { alert("The input is: " + RegExp.input); } else { alert("The input does not contain W3"); } } </script> <form name="frm1"> Enter some Text and click outside: <input type="text" name="txtinput" onChange='getRegInput()'><br /> Input will only show if text contains W3. </form> |
JavaScript input Property
Reviewed by 1000sourcecodes
on
22:18
Rating: