Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Changing DIV content with either txt or html file.

Featured Replies

Hey so I currently have a row of images that each change the source of an image on my page to a different image and its href.

 

Now What I also need each image to do is change the content of the div below each div so each image shows a different description.

 

I've tried innerHTML but that doesn't sleep to work when you supply text such as <h3>TITLE</h3><p>TEXT HERE</p> as the text just doesn't display and obviously I want to use my CSS to style this text.

 

Thanks :)

If you insert some tags with innerHTML , they will in fact show up.

It's not really a clean way of doing it , but it's ok.

 

Are you sure your script is working ?

 

Léon

How about using jQuery's .html() function?

Yes, jQuery is the way forward for this. One simple line like

 

$('#id_0f_the_div').html('<h3>TITLE</h3><p>TEXT HERE</p>'); is all you need

 

Obviously you need to include the jQuery core file in your page but after that it makes things dead simple.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.