How to write a jQuery selector to find links with # in href attribute?

Amit D
Published on 16-Dec-2017 07:29:21
ExampleYou can try to run the following code to write a jQuery selector to find links with # in href. Here, ^ is used to find links starting with # in href.Live Demo<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){    $('a[href^="#"]').click(function(){       alert('Success! Selected link starting ... Read More

How to use JavaScript variables in jQuery selectors?

Amit D
Published on 16-Dec-2017 07:23:14
It’s quite easy to use JavaScript variables in jQuery selectors.ExampleLet’s seen an example to use JavaScript variables in jQuery to hide an element:Live Demo<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){    $("input").click(function(){         var name = this.name;       $("input[name=" + name + "]").hide();   ... Read More

Sort data in SQL using Dynamic SQL in SAP HANA

Giri Raju
Published on 13-Dec-2017 10:10:23
In order to execute dynamic SQL in your stored procedure, you need to use the ‘EXECUTE IMMEDIATE’ statement. You can use SQL as shown below to execute it:EXECUTE IMMEDIATE 'SELECT <COLUMN NAMEs> FROM <TABLE NAME> ' || :<ORDERING COLUMN> || ' DESC';Another thing to notice over here is that if ... Read More

How do we use jQuery selector eq:()?

David Meador
Published on 16-Dec-2017 07:14:27
If you want to select an element with a specific index, then use the jQuery selector eq(). Here, set the index number to select the element.ExampleYou can try to run the following code to learn how to use jQuery selector eq():Live Demo<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){   ... Read More

What is the difference between jQuery(selector) and $(selector)?

David Meador
Published on 16-Dec-2017 07:10:54
The $ variable is for jQuery.  If you’re using more than one JavaScript library or multiple versions of jQuery, then you should use jQuery(selector) instead of $(selector) to avoid name conflicts.ExampleTo understand the noConflict() concept, let us see an example of using the jQuery (selector):Live Demo<!DOCTYPE html> <html> <head> <script ... Read More

How to get a set of elements containing all of the unique immediate children of each of the matched set of elements?

David Meador
Published on 16-Dec-2017 07:05:20
The children( [selector] ) method gets a set of elements containing all of the unique immediate children of each of the matched set of elements.ExampleYou can try to run the following code to learn how to get a set of elements containing all of the unique immediate children of each ... Read More

How to locate all the descendant elements of a particular type of element?

David Meador
Published on 16-Dec-2017 07:01:45
The find( selector ) method can be used to locate all the descendant elements of a particular type of elements. The selector can be written using any selector syntax.ExampleYou can try to run the following code to learn how to locate all the descendant elements of a particular type of ... Read More

How to exclude first and second element from jQuery selector?

Amit D
Published on 15-Dec-2017 21:00:38
To exclude first and second element from jQuery, use the slice() method.ExampleYou can try to run the following code to exclude first and element from jQuery:Live Demo<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){    $('p').slice(2).css('font-size', '24px'); }); </script> </head> <body> <p>Java</p> <p>C++</p> <p>Ruby</p> <p>Groovy</p> </body> </html>Read More

How do we use .not() with jQuery selector?

Amit D
Published on 15-Dec-2017 20:41:12
The .not() is used to select all <p> elements except an element, which can be specified.ExampleYou can try to run the following code to learn how to use .not()  with jQuery selector.Live Demo<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){   $("p:not(.myclass)").css("background-color", "red"); }); </script> </head> <body> <h1>Heading</h1> <p ... Read More

How to remove DOM elements in jQuery?

Amit D
Published on 15-Dec-2017 20:36:46
The empty( ) method remove all child nodes from the set of matched elements whereas the method remove( expr ) method removes all matched elements from the DOM.ExampleYou can try to run the following code to learn how to remove DOM elements in jQuery:Live Demo<html>    <head>       ... Read More
Advertisements