To check whether the file or folder exists, we need to interact with the OS filesystem. Python made it easy by providing the “os” module. It provides the functionality to interact with the operating systems. Just import “os.path” module and…
Many times I have faced the same issue i.e. lost the mouse control when performing the drag and drop in the virtual box. I am not sure what happened internally but with the below procedure, I got the mouse control…
Please have a look at the following articles i.e. polymorphism and inheritance in C++ which is really important to know before going through the virtual functions. As we know, through inheritance one class (derived class) can inherit the features of…
Like normal input fields, values from the hidden input field can be accessed using the element.val(). Following is an example of how to do that. val() function fetches the html value from the specific object and in this case it…
This can be done by using getElementsByTagName() or querySelectorAll(). Old browsers don’t support the querySelectorAll() so in such a case you have to use the other one and then manually write a for loop to iterate over each node and…
For every click, an event will be triggered and that event contains all the info about the element. So, we obviously have to catch that event to get the element info and it can be easily done with JS. When…
As per my experience, the screen rotation behaviour across different devices is not the same. The events such as resize and orientation may not fire simultaneously and occur at different timeframes. The values such as window.orientation and screen.width may not…
To set the document title in reactJS, we can create a custom hook and use it. The following is the solution. Now, use the above custom hook in whichever component you want. The above custom hook updates the title with…
It is straightforward to replace the DOM element in javascript with some other element. replaceWith() method is used to replace the HTML element in Javascript. Follow is the working example: This is a span element Code: Explanation In the above…
Unlike java where the object for the class can be declared only in the heap, C++ allows us to allocate memory for an object in the stack Object in stack If an object is required for a shorter amount of…