JavaScript/jQuery Chaining Tag Replacement Calls -
i'm having problem having 2nd phone call .replacewith overwrite old content written .replacewith. how handle issue below :
if (data==-3){ $('message').replacewith('ffgd'); } else if (data==-4){ $('message').replacewith('dfdsfdsfds');
on first phone call when info -3, see ffgd. when 2nd phone call occurs , data=-4, know else if block run because of console.log messages doesnt overwrite ffgd.
once utilize replacewith
original element gone... there no message
tag replace sec time.
perhaps want replace it's contents can done using text()
or html()
methods
see api docs: http://api.jquery.com/replacewith/
javascript jquery
No comments:
Post a Comment