Code:
function disableOption(pos)
{
//document.getElementById("selectSuggestion").options[pos].disabled=true; <-- this is what I want to do
var option = $(#selectRating).children()[pos]; <-- doesnt work
$(#selectRating).find(option).prop("disabled", true);
}
function addEventListeners()
{
$(#selectRating).bind("focus", disableOption(0));
}
function init()
{
addEventListeners();
}
$(document).ready(init);
I'm not too familiar with the jQuery API and the syntax, I've checked http://api.jquery.com/category/traversing/ and other similar threads but haven't found a solution.
EDIT:
fixed code:
function disableOption(pos)
{
$("#selectRating option:eq(" + pos + ")").prop("disabled", true);
}
function addEventListeners()
{
$("#selectRating").on("focus", function() {disableOption(0);});
}
function init()
{
addEventListeners();
}
$(document).ready(init);