You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by matias nahuel heredia <ma...@informaticos.com> on 2015/04/07 17:06:08 UTC
how change a HTML class with javascript
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;");});
the question is how can i remplaze this using javascript?
Fwd: how change a HTML class with javascript
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
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?
>
Re: how change a HTML class with javascript
Posted by Martin Grigorov <mg...@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?
>