I'm using jQuery 1.7.1. The following code appends an additional option to my select menus that appends a .click event. This code works perfectly fine in firefox/ie9, but gives me the following error in ie7/8 when clicking on the Add New Option. I've tried the select event without any luck as well. Does anybody know how to make this work in legacy browsers like ie7/8
$("select").append($('<option></option>').text("Add New Option").click(function(){
alert("test");
}));
JS Error SCRIPT5022: Syntax error, unrecognized expression: # jquery-1.7.1.js, line 4179 character 2
JS Fiddle example