I have many images that are all part of one class, here is the code:

class='button_cell'

Can I please have some help to set all of these images to not be visible via Javascript?

I use the following code to set all items in a DIV to be disabled:

$('#incident_div').find('input, textarea, button, select').attr('disabled',true);

I am guessing that the code should be similar, yet I am stuck.

May I please have some help with this?

有帮助吗?

解决方案

You can select all of the images in the button_cell class using $('.button_cell') and then use the hide() function to hide them all, like so:

$('.button_cell').hide();

其他提示

I'm not sure exactly what you want, if you want to hide them use:

$('#incident_div').find('input, textarea, button, select').hide();

If you want to hide elements with class 'button_cell' you can use

 ('button_cell').hide()

If you just want to disable them as in grey them out try:

$('#incident_div').find('input, textarea, button, select').each(function(){
    $(this).attr("disabled",true);
});

Here is a working fiddle: http://jsfiddle.net/XfVvf/

To hide by class:

$('.button_cell').hide();

This will select all elements of class "button_cell" and hide them.

Similarly, to show them:

$('.button_cell').show();

Reading: jQuery selectors

This is a good start, but without seeing more it is hard to know...

$('.button_cell').show();

I did show instead of hide because you said you want them to not be invisible...which means visible.

If in fact you would like them to be invisible use:

$('.button_cell').hide();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top