You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2015/04/08 09:47:03 UTC

Fwd: how change a HTML class with javascript

forwarding onto users@i.a.o


---------- Forwarded message ----------
From: Martin Grigorov <mg...@apache.org>
Date: 8 April 2015 at 08:36
Subject: Re: how change a HTML class with javascript
To: dev <de...@isis.apache.org>


Hi,

This is a question for users@ mailing list.

On Tue, Apr 7, 2015 at 6:06 PM, matias nahuel heredia <
matias@informaticos.com> wrote:

> hi!i must change a class with javascript
> public String helloWorld(                       final
> @ParameterLayout(named="name",cssClass="unaclase") String nameOfLove     )
>      {               return "ok";    }
> i change in the css the color of the class and works normaly
> .unaclase{color:blue;}
> but i can“t modify the color for example whit javascript like this
>  $(document).ready(function() {
> document.getElementById("unaclase").setAttribute("style",
> "background-color: #000000; width: 200px; height: 100px;");});
>

You should use #getElementsByClassName()[0]. Even better use jQuery:
$('.unaclase').css({....})


> the question is how can i remplaze this using javascript?
>