traverse in a html file using jquery
optimize code