console.log is giving good result, jquery not