test
test

Reputation: 18200

Making the first image in a row be gone with jQuery

I have a list with an option to delete them. However, no one can ever have zero and must have at least one. So I thought at the start of page load to make the first <a> to the delete be gone.

I tried this:

$(".delete-language").children(':first').attr('display', 'none');

and nothing.

Here is it:

<a id="1" name="40" href="#" class="delete-language"><img style="margin-left:7px;" src="images/icons/cross.png" alt="Delete" title="Remove" display="none"></a>

Upvotes: 0

Views: 39

Answers (1)

maček
maček

Reputation: 77778

.attr('display', 'none') is a bit wrong as display is not an HTML attribute.

If you want to modify the css directly, use .css('display', 'none')

Better yet

$('.delete-language img').first().hide();

Upvotes: 3

Related Questions