On Wed, Apr 29, 2009 at 3:17 PM, Andy <adharb...@gmail.com> wrote:
>
> Is there a way to grab the text from inside a alt tag?  I have a site
> that will have tons of span tags and I need to go through all of them
> searching for the alt="" attribute then grab it.
>
>
> I'm using some non-jQuery javascript, so I'm sure there is an easier
> way to format this than what I currently have.  Any thoughts on this
> would be great.
>
>
> ----- html example:
>
> <span>text here</span>
> <span alt="Joe">text here</span>
> <span alt="Jim">text here</span>
> <span>text here</span>

<script type="text/javascript">
        $(document).ready(function() {
                $('span').each(function() {
                        if ($(this).attr('alt') == "undefined")
                                $(this).attr('alt', '');
                });
        });
</script>

-- 
I have failed as much as I have succeeded. But I love my life. I love
my wife. And I wish you my kind of success.

Reply via email to