Here is my code:
category = $(document).find(".chosen-single:not(.chosen-default) > span:first-child")[0].outerHTML
Sometimes it throws:
Uncaught TypeError: Cannot read property 'outerHTML' of undefined
What kind of condition should I put on the way of that?