Truncate Multiple Strings After 100 Characters in ABAP

Daniol Thomas
Updated on 18-Dec-2019 07:41:29

539 Views

You can just define a character of 100 bytes and move your variable to that character. Please find the below code as example.Example  

Use jQuery Selector eq

David Meador
Updated on 18-Dec-2019 07:38:02

274 Views

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 $(document).ready(function(){    $("p:eq(1)").css("background-color","red"); }); Heading 1 This is demo text. This is another text. This is demo content

Change First and Last Elements of a List using jQuery

Ricky Barnes
Updated on 18-Dec-2019 07:35:28

795 Views

To change the first and last elements of a list use the eq() method.ExampleYou can try to run the following code to change first and last elements of a list using jQuery:Live Demo    $(document).ready(function(){    $("#list li:eq(2)").after($("#list li:eq(0)"));  });     This year's ranking:   India   US   UK Last year's ranking:   India   US   UK

jQuery Selector for Links with Hash in Href Attribute

Amit D
Updated on 18-Dec-2019 07:34:31

4K+ Views

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 $(document).ready(function(){    $('a[href^="#"]').click(function(){       alert('Success! Selected link starting with # in href.');    }); }); Demo C++

Escape Square Brackets in jQuery Selector

Amit D
Updated on 18-Dec-2019 07:33:37

535 Views

To escape square brackets in jQuery selectors is quite easy. Let’s see with an example of escaping the brackets in the name of the box.ExampleWhatever you will select, will get added to the textarea on button click.Live Demo $(document).ready(function() {     $("#addnow").click(function () {        $("#myselect :selected").each(function () {           $("#text").val($("#text").val() + $(this).text() + "");        });     }); });     email@example.com     David Select and Click to Add

How jQuery Slice Method Works

Amit D
Updated on 18-Dec-2019 07:24:59

180 Views

The slice(start, end) method selects a subset of the matched elements. The following are the parameters of the slice() method:start − Where to start the subset. The first element is at zero. Can be negative to start from the end of the selection.end − Where to end the subset excluding end element. If unspecified, ends at the end of the selection.ExampleYou can try to run the following code to select a subset of the matched elements using the slice() method:Live Demo           jQuery slice() method                       ... Read More

Difference Between jQuery add and jQuery append Methods

Amit D
Updated on 18-Dec-2019 07:23:06

377 Views

jQuery add() methodIf you want to add element to an existing group of elements, then use the add() method.ExampleYou can try to run the following code to learn how to work with jQuery.add() method:Live Demo   $(document).ready(function(){     $("h1").add("span").css("background-color", "yellow");   }); Tutorialspoint Text Tutorials for free. Video Tutorials for free. jQuery append() methodThe append() method appends content to the inside of every matched element.ExampleYou can try to run the following code to learn how to work with jQuery append() method:Live Demo             ... Read More

Traverse Data Object Model (DOM) Nodes Using jQuery

David Meador
Updated on 18-Dec-2019 07:11:56

413 Views

jQuery traversing is used to find elements based on what is their relation twith other elements. You need to begin with one selection and move ahead till you the reach the elements you want.jQuery is a very powerful tool which provides a variety of DOM traversal methods to help us select elements in a document randomly as well as in sequential method.Let’s filter out the elements by traversing. The filter( selector ) method can be used to filter out all elements from the set of matched elements that do not match the specified selector(s).ExampleThe selector can be written using any ... Read More

Filter Object Array Based on Attributes in jQuery

David Meador
Updated on 18-Dec-2019 07:10:59

2K+ Views

To filter object array based on attributes in jQuery, use the map() method with JSON.ExampleYou can try to run the following code to learn how to filter object array based on attributes in jQuery,Live Demo $(document).ready(function(){    $(document).ready(function(){     var json ={"DEPARTMENT": [             {                 "id":"1",                 "deptemp":"840",                 "shares":"1100",                           },             {                 "id":"2",                 "deptemp":"1010",                 "shares":"1900",                   }, {                 "id":"1",                 "deptemp":"350",                 "shares":"510",             },             {                 "id":"2",                 "deptemp":"575",                 "shares":"1900",             }]};            json.DEPARTMENT = $.map(json.DEPARTMENT,function(val,key) {               if(Number(val.deptemp) = 500) return val;            });         for(var i in json.DEPARTMENT)        $("p").html("Department Employees: "+json.DEPARTMENT[i].deptemp+" ,  Shares:"+json.DEPARTMENT[i].shares)     }); });

Find Cost Price from Selling Price and Profit or Loss Percentage in C++

Arnab Chakraborty
Updated on 18-Dec-2019 07:10:28

297 Views

Consider we have the selling price, and percentage of profit or loss is given. We have to find the cost price of the product. The formula is like below −$$Cost \: Price = \frac{Sell Price * 100}{100 + Percentage \: Profit}$$$$Cost \: Price = \frac{Sell price *100}{100 + percentage\:loss}$$Example Live Demo#include using namespace std; float priceWhenProfit(int sellPrice, int profit) {    return (sellPrice * 100.0) / (100 + profit); } float priceWhenLoss(int sellPrice, int loss) {    return (sellPrice * 100.0) / (100 - loss); } int main() {    int SP, profit, loss;    SP = 1020;    profit = 20;    cout

Advertisements