Getting a tag client id with JavaScript might be an issue. Here's how you can get your tag using DOM.
Some of this content is outdated and needs to be reviewed.
document.getElementById('div-id').childNodes[0]
TODO: there are better ways to handle this in JSF2
Related Documentation
JavaScript Client Web UI Framework Web UI Framework Overview