javascript - DOM updates not shown in 'View Source', only in 'Inspect Element' -


i have write simple script 1 change alts in img tag. not working. here script:

jquery(document).ready(function($) {     var slowakluczowe = ['alt1', 'alt2', 'alt3'];     $("img").attr("alt", function() {         return slowakluczowe[math.floor(math.random() * slowakluczowe.length)];     }); }); 

the script takes random alt , pins in image doesn't work well. doesn't change alt when click 'view source' works when click 'inspect element'.

see here: http://prntscr.com/boo9jk

it's working 'inspect element' how can make work 'view source'?

view source displays original data received server. cannot changed javascript. browser inspector shows live representation of dom, updated javascript.

the way change data when click 'view source' send data server, make changes there, , refresh page whatever method. can't see why ever need though. perhaps want let user edit content, viewable all. in case need send information server, store in database, , use information when presenting page users.

the inspector more powerful tool , 1 should using. view source useful when want see data in unadulterated form, i.e. before javascript on page has run.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -