How to change css of element using jquery

css, html, jquery

Solution

Just use:

$('#button1').click(
    function(){
        $('#myEltId span').css('border','0 none transparent');
    });

Or, if you prefer the long-form:

$('#button1').click(
    function(){
        $('#myEltId span').css({
            'border-width' : '0',
            'border-style' : 'none',
            'border-color' : 'transparent'
        });
    });

And, I'd strongly suggest reading the API for `css()` (see the references, below).

References:

- `css()`.

Problem

I have defined a CSS property as ``` #myEltId span{ border:1px solid black; } ``` On clicking a button, I want to remove its border. ``` $('#button1').click(function() { // How to fetch all those spans and remove their border }); ```

Original source