lundi 25 mai 2015

add and remove div attribute with checkbox

i need to add id to div.

my code not work.

    <div class="quote-box-col14" for="seo">
<label for="seo" class="quote-service-seo">SEO</label>
<input type="checkbox" name="seo" id="seo" value="Y" class="checkbox-seo" />
</div>

js code

$('#quote-box-col14').change(function(){
    if($(this).is(":checked")) {
        $( "#quote-box-col14" ).attr( "id", "check" );
    } else {
       $( "#quote-box-col14" ).removeAttr("id");
    }
});

js fiddle - http://ift.tt/1RgUjrd




Aucun commentaire:

Enregistrer un commentaire