Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Which is the code with which we can retreive alternative text of image:

It is a Cataloge with clothes. Dressers, Shirts, Skirts e.t.c. in front page of a site. The featured images of the categories can be changed manually from someone. I did a check and it is asking me to give alt text. I did it to some images with alt="". But to the cataloge I cannot do it.

the code is below:

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js"></script>

  {{ 'option_selection.js' | shopify_asset_url | script_tag }}
  {{ 'api.jquery.js' | shopify_asset_url | script_tag }}

  {% if template contains 'customers' %}
  {{ 'shopify_common.js' | shopify_asset_url | script_tag }}
  {{ 'customer_area.js'  | shopify_asset_url | script_tag }}
  {% endif %}

  {% if settings.display_slideshow %}{{ 'jquery.slider.js' | asset_url | script_tag }}{% endif %}
  {% if settings.include_masonry %}{{ 'jquery.masonry.js' | asset_url | script_tag }}{% endif %}
  {% if settings.enable_product_image_zoom %}{{ 'jquery.zoom.js' | asset_url | script_tag }}{% endif %}
  {{ 'fancy.js' | asset_url | script_tag }}
  {{ 'shop.js' | asset_url | script_tag }}
  <script type="text/javascript">
  Shopify.money_format = '{{ shop.money_format }}';
  </script>
  {% if template contains "product" %}
  <script type="text/javascript">
  jQuery(document).ready(function($){
    {% if product.variants.size > 1 or product.options.size > 1 %}
    new Shopify.OptionSelectors("product-select", { product: {{ product | json }}, onVariantSelected: selectCallback });

    {% assign found_one_in_stock = false %}
    {% for variant in product.variants %}
    {% if variant.available and found_one_in_stock == false %}
    {% assign found_one_in_stock = true %}
    {% for option in product.options %}
    $('#product-select-option-' + {{ forloop.index0 }}).val({{ variant.options[forloop.index0] | json }}).trigger('change');
    {% endfor %}
    {% endif %}
    {% endfor %}

    {% endif %}
  });
  </script>
  <script>
  $(function() {
    $( "#tabs" ).tabs();
  });
  </script>
share|improve this question

closed as off-topic by John Conde Nov 7 '13 at 15:51

  • This question does not appear to be about webmastering within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

    
This question appears to be off-topic because it is about programming which is off-topic at Pro Webmasters. Programming questions may be asked at Stack Overflow but be sure to read their FAQ before posting to ensure your question meets their guidelines. –  John Conde Nov 7 '13 at 15:51

1 Answer 1

Its difficult to understand your code,

In jQuery you can get the image alt

jQuery("#image_id").attr('alt');

if you need to set some alt tag you can use as below.

jQuery("#image_id").attr('alt','your text');

If the image have no id or class you can select with img tag too, in that case more than one img on the same page you have to loop them like below.

jQuery("img").each(function(){
var alt_var = jQuery(this).attr('alt');
});

hope its helps..

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.