Thanks everyone,
The prop() and val() methods work, but the problem I was having before (which prevented any method from working) was that the script was being run before the DOM objects were available. The script was at the top of the page and it called my function (which included the code in the OP) before anything was loaded onto the page. Replacing the function call with:
$(document).ready(MyFunction);
did the trick. It says to call MyFunction() only when the page is ready.