开发者

safari doesn't (dynamically) refresh $.html() content

开发者 https://www.devze.com 2023-03-16 07:06 出处:网络
I have the following piece of code $(\'#charactersRemaining\').html(123-countChars(this.value)); Works in all browsers except Safari.

I have the following piece of code

$('#charactersRemaining').html(123-countChars(this.value));

Works in all browsers except Safari. Even in Safari, if I click the content in the div area ( of id=charactersRemaining), it refreshes, but it doesn't refresh automatically/dynamically

Any way to force Safari to refresh?

$().html('new content');

Update: I have used the following 'hack' (for safari). But still interested to know if I have missed any technical detail

$('#x').html('new'开发者_StackOverflow社区); 
$('#x').hide(); 
$('#x').fadeIn(); // or you could use .show();


Finally, I found the issue. I had an image nearby (may be floating/layering over the text). Thus Safari didn't redraw the underlying text (or some quirk).

Anyway moved the image around and it works in safari too


i had the exact same problem, but what i found out is that my elements that were having this problem had in style position relative. if i change that it works just fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消