I am new to reg exp I have searched lot about pattern to find the circle brackets in the string value finally i found. But this was not working when i am getting the value from DIV
Here is the javascript code
function myText(){
var inputString = document.getElementById("text").innerHTML;
var result = inputString.match(/\(+/g);
alert(result);
}
myText();
HTML code
<div id="text">
welcome to (MotherLand)
</div>
I tried with removing .value from the inputString
I am getting the result as null in alert. I tried with removing .value from the inputString
Iam getting the error in console window Cannot read property 'match' of undefined
I am getting the result as null in alert
I want only the circle brackets not inside the value.
The output should be (
Kindly explain me what I am doing wrong.
fiddle link
Thanks Mahadevan