Link to home
Start Free TrialLog in
Avatar of cgray1223
cgray1223

asked on

remove html select option using jquery

Hello,

I'm trying to dynamically remove an html select option item but I'm unable to get it to remove unless I hardcode the option value. I need to remove the select option based on the value passed to the function below...any ideas on where I've gone wrong?
function loadGallery(albumId, albumTitle){
	$("#selectAlbum option[value='37']").remove(); //hard coding it works
        $("#selectAlbum option[value=' + albumId + ']").remove(); //this doesn't work, but no error

}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I believe you do not need the single quotes
$("#selectAlbum option[value=" + albumId + "]").remove();

Open in new window