jQuery .remove() option using :contains() -


at bottom of page line "step 2" opens accordion tab. on first section of interface 2nd drop down reads select servive.

im trying use :contains() , .remove() remove options contain word phone in text. here's code, doesn't seem work. error reads im missing closing ) cant see where.

<select class="ab-formelement ab-select-mobile ab-select-service">    <option value="">select service</option>    <option value="1">early pregnancy scan</option>    <option value="2">2d sexing / gender scan</option>    <option value="18">phone booking &gt; bundle of joy</option>      </select>  jquery(document).ready(function($){ $=jquery; var option = jquery('select.ab-select-service option:contains('phone')'); $(option).remove(); }); 

update: ive noticed else. try of elements within plugin seem not work. theres difference in syntax on jquery , code in scripts file.

https://jsfiddle.net/7oh7k47m/

you're nesting ' inside ', prematurely terminating string. need escape nested ' \'.

var option = jquery('select.ab-select-service option:contains(\'phone\')'); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -