The code is suppose to say matched! for the given string. I tried multiple things and cannot get it to work.
HTML:
<div id="ssn">123-45-6789</div>
js:
var regex = new RegExp("^\d{3}-\d{2}-\d{4}$");
$("#div")
.filter(function() {
return this.innerHTML.match(regex);
})
.html("Matched!")
;
<div>has the id "ssn", but your jQuery selector says"#div"...