javascript - Name automatically an alt tag -


in script how add alt tag value same "nikeair 32" in example?

<script>    function test_options_rendered(){     $('.test_option_value').each(function(){                   if( !$(this).parent().hasclass("conditional")){         $(this).find('input:radio').first().prop("checked", true);         // $(".test_radio_option :input:first").prop("checked", true);       }     });     $('.test_radio_option:contains("nike air32")').append('<img class="option_img" src="https://image.png">');   }  </script> 

if want add alt tag img can this:

$('.test_radio_option:contains("nike air32")')    .append('<img class="option_img" alt="nike air32" src="https://image.png">') 

if want more dynamically can this:

$('.test_radio_option:contains("nike air32")').each(function() {     $(this).append('<img class="option_img" alt="' + $(this).text() + '" src="https://image.png">'); }); 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -