Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript image mouseover, replace div text

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28354
    wattsup
    Member

    I am trying to change a div content via mouseover some images. I thought this might do it but no luck. I would like to mouse over the image with an ID of img1, img2 and img3 then have the div below replace the text with the var text.

    Code:
    var $img1 = ‘

    From the outset, Bla Bla Bla one.

    ‘;
    var $img2 = ‘

    From the outset, Bla Bla Bla two.

    ‘;
    var $img3 = ‘

    From the outset, Bla Bla Bla three.

    ‘;

    $(function() {
    var $cb = $(“.mark_container”);
    $cb.mouseover(function() {
    $cb.removeClass(“active-mark”);
    $(this).addClass(“active-mark”);
    var $picTxt = $(this).find(“img”).attr(“id”);
    $(‘#mark_txt’).html(”).html($picTxt); <------------------ Problem }).mouseout(function() { $cb.removeClass("active-mark"); $(this).addClass("mark_container"); $('#mark_txt').html('').html($defaultTxt); <------------------ Problem }); })

    Code:
    here is my html

    temperature
    inventory
    quick

    From the outset, Default text

    #72302
    wattsup
    Member

    Thanks jamy_za, I had it that way at first but was looking to create an function.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.