Set a Fixed Element and Scroll Another in jQuery

AmitDiwan
Updated on 09-Nov-2020 07:30:18

2K+ Views

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

Access File Contents in jQuery Callback Function

AmitDiwan
Updated on 09-Nov-2020 07:24:35

670 Views

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

Output Only the First Word from Select List Value in jQuery

AmitDiwan
Updated on 09-Nov-2020 06:58:31

984 Views

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

Put URL into a Variable When Button is Clicked in jQuery

AmitDiwan
Updated on 09-Nov-2020 06:55:08

812 Views

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 −

Difference Between Single Quote and Double Quote in PowerShell

Chirag Nagrekar
Updated on 09-Nov-2020 06:49:46

5K+ Views

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

Remove Next Element Using jQuery

AmitDiwan
Updated on 09-Nov-2020 06:37:54

2K+ Views

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 −

Not-Not Operator in JavaScript: Equivalent to Reverse Process of Not Operator

AmitDiwan
Updated on 09-Nov-2020 06:25:30

240 Views

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

Determine if C# .NET Core is Installed

Nizamuddin Siddiqui
Updated on 07-Nov-2020 12:22:15

3K+ Views

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

Resize an Image in C#

Nizamuddin Siddiqui
Updated on 07-Nov-2020 12:14:52

585 Views

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

Limit Parallel ForEach in C#

Nizamuddin Siddiqui
Updated on 07-Nov-2020 12:12:44

2K+ Views

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

Advertisements