using attr function instead of data function of jquery