We have the following javascript:
<script type="text/javascript">
try {
if (typeof jQuery === 'function') {
jQuery(document).ready(function() {
if (document.URL.indexOf('http://test.com/browse/ID-2007') === 0) {
jQuery('#test').hide();
}
});
}
} catch(err) {}
</script>
How to fix the script so that jQuery('#test').Hide(); performed wherever ID > 2007
If the part of the URL leading up to the ID is always the same, you could just remove that part, parse the remaining part into a number and check it:
If more complex matching is needed, the
string.replace()method can take a regular expression to use for matching as well.