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
357
votes
12 answers

Java - get the current class name?

All I am trying to do is to get the current class name, and java appends a useless non-sense $1 to the end of my class name. How can I get rid of it and only return the actual class name? String className = this.getClass().getName();
aryaxt
  • 76,198
  • 92
  • 293
  • 442
151
votes
8 answers

Getting name of the class from an instance

I have the following problem: I get an instance of a class passed and want to know the name of the class of this instance. How to get this?
Robin
  • 8,197
  • 11
  • 45
  • 74
105
votes
4 answers

How to get current class name including package name in Java?

I'm working on a project and one requirement is if the 2nd argument for the main method starts with “/” (for linux) it should consider it as an absolute path (not a problem), but if it doesn't start with “/”, it should get the current working path…
La bla bla
  • 8,558
  • 13
  • 60
  • 109
84
votes
7 answers

Finding elements by class name with Selenium in Python

How can I filter elements that have the same class?

Link1.

Link2.

Sree
  • 849
  • 1
  • 6
  • 3
79
votes
5 answers

Add a class to the HTML tag with React?

I'm making a modal in my React project that requires a class to be added to the body when the modal is open and removed when it is closed. I could do this the old jQuery way by running some vanilla JavaScript which adds / removes a class, however…
Evanss
  • 23,390
  • 94
  • 282
  • 505
77
votes
7 answers

javascript document.getElementsByClassName compatibility with IE

What is the best method to retrieve an array of elements that have a certain class? I would use document.getElementsByClassName but IE does not support it. So I tried Jonathan Snook's solution: function getElementsByClassName(node, classname) { …
Web_Designer
  • 72,308
  • 93
  • 206
  • 262
75
votes
2 answers

Association between naming classes and naming their files in python (convention?)

In python (and some other languages) I have learned, that the name of a class should be written in small letters except for the first letter of each word, which should be a capital letter. Example: class FooBar: ... A class should go in a file,…
Aufwind
  • 25,310
  • 38
  • 109
  • 154
75
votes
6 answers

How can I easily get a Scala case class's name?

Given: case class FirstCC { def name: String = ... // something that will give "FirstCC" } case class SecondCC extends FirstCC val one = FirstCC() val two = SecondCC() How can I get "FirstCC" from one.name and "SecondCC" from two.name?
pr1001
  • 21,727
  • 17
  • 79
  • 125
61
votes
2 answers

jquery e.target.hasClass not working

I dynamically create a new div (with a "textbox" class and ID), and some other elements inside of it, and later on in my code I bind that div to the click event, and display the element clicked, like so: $('#textbox_'+i).bind('click',…
user961627
  • 12,379
  • 42
  • 136
  • 210
47
votes
10 answers

Netbeans Shortcut to Open File

I remember seeing someone use a shortcut in NetBeans to open a dialog similar to phpStrom that can open files based on class names or is it file name. whats that?
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
33
votes
2 answers

QT : get the class name of an object

I'm writing a test app that simulates key presses of another application. For every key press I have to check if the right window/form is shown. So what I do is get the pointer of the window being shown and get it's window title. However, not all…
Owen
  • 4,063
  • 17
  • 58
  • 78
28
votes
4 answers

C# .cs file name and class name need to be matched?

In Java the file name must be the public class name defined in that java file. Does C# has similar requirement? can I have a A.cs file which only defines a public Class B inside? thanks,
5YrsLaterDBA
  • 33,370
  • 43
  • 136
  • 210
21
votes
4 answers

Remove classname from element with javascript

I found the following regex from another Stack Overflow question: Change an element's class with JavaScript And have used it in part of my script with success, however in another it seems to be failing. I threw together a very minimalist test case…
Chris Sobolewski
  • 12,819
  • 12
  • 63
  • 96
21
votes
4 answers

Why does Scala place a dollar sign at the end of class names?

In Scala when you query an object for either its class or its class name, you'll get a rogue dollar sign ("$") at the tail end of the printout: object DollarExample { def main(args : Array[String]) : Unit = { printClass() } def…
smeeb
  • 27,777
  • 57
  • 250
  • 447
20
votes
4 answers

className in in Redux Form

I've created a redux-form and i want to add className to each Field to customize them with css. The code for each field is:
RamAlx
  • 6,976
  • 23
  • 58
  • 106
1
2 3
41 42