First let me ask you a question. Are you using JSP and JSF together? If you are then, the element ID which you are giving as an argument to java script might be different from the "content" when it is transformed to html code in the background. Try looking at the source of the page and see if the ID of the element is same as "content". If it is different then you need to give that ID to java script.