Questions tagged [classname]

Classname may refer to classes in scripting languages and markup languages. Typically, a class denotes a certain part of the application which can be manipulated.

620 questions
18
votes
2 answers

Get only first class of an HTML element

I'm using the event.target.className to get the ClassName, but sometimes an element has multiple class names, how can I make it, so it only gives the first class name as outcome? Oh, and please without jQuery.
user1544892
17
votes
3 answers

How to represent class names in LaTeX?

what do you see as best way of presenting class names in LaTeX documents (writing about a piece of software). I'm currently using \texttt (monospaced typewrite font) which otherwise works fine but my class names end up goind "over" the margins. So,…
Touko
  • 11,359
  • 16
  • 75
  • 105
16
votes
3 answers

styling react-select using classes

I am using react-select in my code. https://www.npmjs.com/package/react-select I want to style my drop down using classNames, so that I referred https://react-select.com/styles. The DOM structure of react slect is shown in the link. How can I style…
Jane Fred
  • 1,379
  • 7
  • 23
  • 47
16
votes
3 answers

JavaScript DOM changes in touchmove delayed until scroll ends on mobile Safari

In mobile safari, in the course of handling touchmove for an element, I change the className of that element. Unfortunately, the visual change does not occur while the user is scrolling, or until the very end of an inertial scroll. What can I do to…
Hilton Campbell
  • 6,065
  • 3
  • 47
  • 79
12
votes
2 answers

Why do some users quote classnames in Perl?

Looking at Type::Tiny, I see that the class name in the call to Type::Tiny->new is quoted in the official docs, my $NUM = "Type::Tiny"->new( name => "Number", constraint => sub { looks_like_number($_) }, message => sub { "$_ ain't…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
12
votes
2 answers

Concat classname with variable Angular 2

I want something like class = "myClass {{classVar}}" I am trying to concat class name with variable value in scope but not working.
Dipak Telangre
  • 1,792
  • 4
  • 19
  • 46
12
votes
6 answers

How to get class name?

If I defined a class: class Blah {}; How can I: std::string const className = /* What do I need to do here? */; assert( className == "Blah" ); I dont think typeid().name() is a good idea since it's compiler implementation specific. Is there…
sivabudh
  • 31,807
  • 63
  • 162
  • 228
12
votes
1 answer

How to check the class name of the event target in ReactJS?

I now have a function handleRightClick(e) which will be called when I right click on the container. Inside the container, there are several Items and I expect the menu will be shown only when I right click one of the Items. export default class…
Casper
  • 4,435
  • 10
  • 41
  • 72
12
votes
7 answers

Is it poor form to use CLASS attributes with no corresponding CSS rule?

For example if I wanted to select some elements with a certain class using jQuery, and for that reason only, is it always expected that those classes SHOULD be defined in the css?.
something
something…
CRice
  • 12,279
  • 7
  • 57
  • 84
12
votes
4 answers

What characters are widely supported in CSS class names?

As detailed here among other places, the only valid characters in a html/css class name is a-z, A-Z, 0-9, hyphen and underscore, and the first character should be a letter. But in practice, what characters are in fact supported by most browsers?…
last-child
  • 4,481
  • 1
  • 21
  • 19
12
votes
1 answer

Find class name of SVG element

How can I find the class name of SVG attribute? If it was div it would have been {reference to DIV}.className But, this doesnt work exactly the same way with SVG element Is there any jquery or javascript method/attribute to get the classes of a SVG…
Cute_Ninja
  • 4,742
  • 4
  • 39
  • 63
12
votes
2 answers

Start Activity Android with class name

I am using Following Code to start setting I want to launch the setting activity which is started by android ins PackageList allowedAppsPackageName=CallHelper.Ds.getPackageList(); PackageManager manager =…
Tushar
  • 1,122
  • 1
  • 13
  • 28
11
votes
3 answers

Java: Can a parent class statically retrieve the class name of a child class?

In reference to Java, I would like to statically know the class name of the current class. A is the parent class of B. I would like to have a static String in A (parent class) which contains the class name of the current class, but when this static…
ChaimKut
  • 2,759
  • 3
  • 38
  • 64
11
votes
3 answers

In rubyonrails, how to get the associated model class from and ActiveRecord::Relation object?

Suppose I have an model: class Post end posts = Post.where(***) puts posts.class # => ActiveRecord::Relation Then how can I get the model class name through the variable 'posts', maybe some method called model_class_name: puts…
Croplio
  • 3,433
  • 6
  • 31
  • 37
10
votes
3 answers

How to access/override the className of an element using refs?

I have a text and a button. What I want to achieve is something like this, that if I clicked the Button the Text will be hidden. I want to achieve this without using state. class Test extends Component { constructor(props){ //codes …
larp
  • 1,017
  • 1
  • 14
  • 23
1
2
3
41 42