Hello colleagues
I have a web page with a lot of divs in it. Some of them contain names such as Smith, Ms Ruth.
I would like the page to load then perform the following code to find the Id of the div in which Ms Smith might be in.
The following code works well in a much smaller page with only 3 divs in it but does not seem to work with the large html page.
I have consulted google till my hair falls out.
Any ideas ?
Rory Barrett
<script id=”myScript”>
var surname = “”;
surname = prompt(‘What is name?’);
alert(surname);//works fine up to here
function getID()
{
$(document).ready(function(){
var z = $(“div:contains(surname)”);
alert(z[0].length);
});//doesn’t work ? But did on a smaller page
}
getID();
</script>