jquery - Changing text on each page load -


i'm starting jquery/javascript , i'm still kind of newbie.

i have list of phrases , need them change inside <h4> everytime page loads/reloads.

i think basic question, can't solution (my mind says it's easy, current coding abilities don't).

thanks in advance !

if don't care order, try:

var texttoshow = ['text1', 'text2', 'text3', 'text4'] $(document).ready(function() {     $("h4").html(texttoshow[math.floor(math.random()*texttoshow.length)]); }); 

here fiddle: http://jsfiddle.net/jzdnv/ keep clicking 'run' different things.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -