Let’s say the following is our fixed element div − Fixed The CSS style to fix the above element −.fixedElement { position: fixed; background-color: skyblue; top: 0; left: 0; right: 0; }Following is our element, which will be scrolled − David Miller Now, use the window.scrollTo().ExampleLet us see the complete code − Live Demo Document .fixedElement { position: fixed; background-color: skyblue; top: 0; left: 0; right: ... Read More
Let’s say the following is our file and we need to read this file using jQuery.The name of the file details −ExampleFollowing is the code − Live Demo Document function chooseFile() { dataFromMyFile = document.getElementById("readFileDemo").files[0]; readDataFromFile = new FileReader(); readDataFromFile.onload = () => { data = readDataFromFile.result; console.log("Your File Data is="); console.log(data); }; readDataFromFile.readAsText(dataFromMyFile); } ... Read More
Let’s say the following is our select − Get First Name Get First Name Only To get only the first word, use split() on the basis of space and can select the 0th index value.ExampleFollowing is the code − Live Demo Document Get First Name Get First Name Only function showFirstValue(choosenObject) { var allValues = choosenObject.value.split(" "); var firstValue = allValues[0]; console.log("The first Name=" + firstValue); } ... Read More
For this, call a function on button click.ExampleFollowing is the code − Live Demo Document ClickMeToCopyURL https://www.tutorialspoint.com/index/ function demoForCopyURL(e) { event.preventDefault(); var rootText = event.target.parentElement.innerText var btnText = event.target.innerText var originalURLValue = rootText.substring(btnText.length + 1) console.log("THE URL IS=" + originalURLValue) } To run the above program, save the file name “anyName.html(index.html)”. Right click on the file and select the option “Open with Live Server” in VSCode editor −OutputThis will produce the following output on console −On clicking the button, you will get the following output on console −
There is no such difference between the single quote (‘) and double quote(“) in PowerShell. It is similar to a programming language like Python. We generally use both quotes to print the statements.ExamplePS C:\> Write-Output 'This will be printed using Single quote' This will be printed using Single quote PS C:\> Write-Output "This will be printed using double quote" This will be printed using double quoteBut when we evaluate any expression or print variable it makes a clear difference.$date = Get-Date Write-Output 'Today date is : $date' Today date is : $date Write-Output "Today date is : $date" Today date ... Read More
To remove the next element in jQuery, use the remove().ExampleFollowing is the code − Live Demo Document cancel(X) Demo cancel(X) Demo cancel(X) Demo $(".demo1").click(function () { $(this).parent().next("hr").remove(); $(this).parent().remove(); return false; }); To run the above program, save the file name “anyName.html(index.html)”. Right click on the file and select the option “Open with Live Server” in VSCode editor −OutputThis will produce the following output −Whenever you click the cancel(X), the jQuery will remove the element. This will produce the following output −
Yes, the not not operator is the reverse process of not operator. If any value is true then single ! (not) will return false and !! will return opposite value (true).The not operator −var flag=true; console.log(!flag);The not not operator −var flag=true; console.log(!!flag);ExampleFollowing is the code −var flag=true; console.log("The result of single !=") console.log(!flag); console.log("The result of single !!=") console.log(!!flag)To run the above program, you need to use the following command −node fileName.js. Here, my file name is demo247.jsOutputThis will produce the following output on console −PS C:\Users\Amit\javascript-code> node demo247.js The result of single != false The result of single !!= ... Read More
The following options are for dotnet by itself. For example, dotnet −−info. They print out information about the environment if not installed it will throw error.−−infoPrints out detailed information about a .NET Core installation and the machine environment, such as the current operating system, and commit SHA of the .NET Core version.−−versionPrints out the version of the .NET Core SDK in use.−−list−runtimesPrints out a list of the installed .NET Core runtimes. An x86 version of the SDK lists only x86 runtimes, and an x64 version of the SDK lists only x64 runtimes.−−list−−sdksPrints out a list of the installed .NET Core ... Read More
A bitmap consists of the pixel data for a graphics image and its attributes. There are many standard formats for saving a bitmap to a file. GDI+ supports the following file formats: BMP, GIF, EXIF, JPG, PNG and TIFF. You can create images from files, streams, and other sources by using one of the Bitmap constructors and save them to a stream or to the file system with the Save method.In the below code CompressAndSaveImageAsync Method Compresses the images and saves in the path Mentioned.The new image name will be a combination of desktop userId and dateTimeExampleprivate async Task CompressAndSaveImageAsync(Bitmap ... Read More
Parallel ForeachParallel.ForEach loop in C# runs upon multiple threads and processing takes place in a parallel way. Parallel.ForEach loop is not a basic feature of C# and it is available from C# 4.0 and above To use Parallel.ForEach loop we need to import System.Threading.Tasks namespace in using directive.ForeachForeach loop in C# runs upon a single thread and processing takes place sequentially one by one. Foreach loop is a basic feature of C# and it is available from C# 1.0. Its execution is slower than the Parallel.Foreach in most of the cases.Example 1static void Main(string[] args){ List alphabets = new ... Read More