I'm setting a variable to the contents of a h1 tag on my site. I want to write an if statement which tests to see if there is a specific word inside that h1 tag. I need to set a dropdown based on the title of the form.
So, I have this html.
<div id="booking-details"><h1>This is Los Angeles</h1></div>
Here is the jquery:
var city = $('#booking-details h1').text();
if (city.text().indexOf('Los Angeles') >= 0)) {alert("This city is Los Angeles")};
I'm getting a syntax error and not quite sure how to pull the index of the text from the variable.
Thanks in advance for any help.