Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

add alt text to image jquery

python answered on April 28, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • how to display an image on text click using jQuery
  • change p text jqwuery

  • add alt text to image jquery

    0

    $(document).ready(function() {

    $('img').each(function() {

    var $img = $(this);

    var filename = $img.attr('src').replace(new RegExp("-", "g"), ' ');

    var filename1 = filename.substring(filename.lastIndexOf('/') + 1);

    var attr = $(this).attr('alt');

    var title = $(this).attr('title');

    if (typeof attr == typeof undefined || attr == false) {

    $img.attr('alt', filename1.substring(0, filename1.indexOf('.')));

    }

    });

    }); 

    Popularity 3/10 Helpfulness 1/10 Language javascript
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Apr 28 2023
    python
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.