Found 8895 Articles for Front End Technology

Page build in HTML and wanted to load into JS view in SAPUI5 application.

Ali
Ali
Updated on 25-Feb-2020 11:06:12

401 Views

The most commonly used way of doing this is to embed the HTML page as an iframe. Here is the example.new sap.ui.core.HTML({    preferDOM: true,    content: "" });It can also be loaded using AJAX call or display using sap.ui.core.HTML, but it will depend upon your HTML page.

In dynamic fashion setting a custom class to a cell in a row

Amit Sharma
Updated on 25-Feb-2020 11:07:08

69 Views

If you need to set CSS properties for a row, then what you can try is to use the predefined CSS class of the table along with the custom class. For Example.sapMListTbl . {    margin: 10px;    color: #ffffff; }Also, you can opt for a formatter while applying the new class along with your model classes.

How to check whether a string contains a substring in JavaScript?

Abhinaya
Updated on 20-Apr-2022 12:44:47

655 Views

JavaScript provides us with different methods to check whether a string contains a substring or not. In this article, we use the following three methods for this purpose-String search() methodString indexOf() methodString includes() methodLet’s explore in detail each method.1. String search() methodThe string search method can be used to search a text (using regular expression) in a string.It matches the string against a regular expression and returns the index (position) of the first match.It returns -1 if no match is found. It’s case-sensitive.The string search() method is an ES1 feature. It is fully supported in all browsers.Syntaxstring.search(searchValue)searchValue is a regular ... Read More

Why do we use "use strict" in JavaScript?

Govinda Sai
Updated on 20-Apr-2022 12:30:05

567 Views

The “use strict” is a directive, which is a literal expression. It was introduced in JavaScript 1.8.5. As the name suggests, “use strict” indicates that the code is to be executed in strict mode.Benefits of using “use strict”It’s easier to write "secure" JavaScript codes.It changes previously accepted "bad syntax" into real errors. As an example, mistyping a variable name creates a new global variable. When using strict mode, this will throw an error. It leads to making it impossible to accidentally create a global variable.A programmer will not receive any error feedback assigning values to non-writable properties.But in strict mode, ... Read More

How to redirect to another webpage using JavaScript?

Ramu Prasad
Updated on 20-Apr-2022 12:40:56

18K+ Views

The window.location object contains the current location or URL information. We can redirect the users to another webpage using the properties of this object. window.location can be written without the prefix window.We use the following properties of the window.location object to redirect the users to another webpage −window.location.href- it returns the URL (href) of the current page.window.location.replace()- it replaces the current document with new document.window.location.assign() loads a new document.The syntaxes below are used to redirect to another web page. We omit the window prefix and use only location in all the program examples. You can try running the programs using ... Read More

Which equals operator (== vs ===) should be used in JavaScript comparisons

Sravani S
Updated on 12-Sep-2019 07:10:20

85 Views

Double equals (==) is abstract equality comparison operator, which transforms the operands to the same type before making the comparison.For example,4 == 4     // true '4' == 4   // true 4 == '4'   // true 0 == false // trueTriple equals (===) are strict equality comparison operator, which returns false for different types and different content.For example,4 === 4     // true 4 === '4'   // false var v1 = {'value': 'key'}; var v2 = {'value': 'key'}; v1 === v2   //false

Using CSS3 in SAP BSP application without using DOCTYPE tag

Amit Sharma
Updated on 30-Jul-2019 22:30:20

163 Views

To add a DOCTYPE tag without changing code of your BSP application, you can try using in Web Server, JQuery, or other UI libraries.There are various other libraries that you can search for as a replacement for CSS3 and they have their own advantage. I have used JQuery UI, Wijmo or Modernizer.

Where do we use $.extend() method in jQuery?

David Meador
Updated on 15-Jun-2020 13:18:40

1K+ Views

The jQuery.extend() method is used to merge contents of two or more objects together. The object is merged into the first object. You can try to run the following code to learn how to use extend() method −ExampleLive Demo $(document).ready(function() {   $("#button1").click(function() {     var obj1 = {       maths: 60,       history: {pages: 150,price: 400,lessons: 30},       science: 120     };     var obj2 = {       history: { price: 150, lessons: 24 },       economics: 250     };     $.extend(true, obj1, obj2);     $("#demo").append(JSON.stringify(obj1));    }); });    Result    

When to use $(document).ready() and when $(window).load() in jQuery?

Alex Onsman
Updated on 30-Jul-2019 22:30:20

728 Views

$(window).load()Use $(window).load(), when you want the code inside it to run only once the entire page is ready (not only DOM).  It executes when the page is fully loaded, including frames, objects and imagesNote: The load() method deprecated in jQuery version 1.8. It was completely removed in version 3.0. To see its working, add jQuery version for CDN before 3.0.$(document).ready()Use the  $(document).ready() method when you want the code inside it to run once the page DOM is ready to execute JavaScript code.

How to iterate over arrays and objects in jQuery?

David Meador
Updated on 15-Jun-2020 13:17:04

1K+ Views

To iterate over arrays and objects in jQuery, use the jQuery forEach() loop. You can try to run the following code to learn how to iterate over arrays and objects −ExampleLive Demo $(document).ready(function(){   $("#button1").click(function(){     var arr = [{subject: "Maths", id:3}, {subject: "History", id:7}];     arr.forEach(function(el, index) {       alert(el.id+" "+el.subject);     });   }); });   Result

Advertisements