Found 601 Articles for Front End Scripts

Difference between div~div and div:not(:first-of-type)?

karthikeya Boyini
Updated on 28-Jan-2020 09:18:12

98 Views

Both are same in terms of matching elements. Let us see an example:                             If you have CSS rules with both selectors matching the same elements, then your div: not(:first-of-type) will get precedence due to the: first-of-type pseudo-class.

What HTML5 tag should be used for filtering search results.

Smita Kapse
Updated on 28-Jan-2020 09:17:26

121 Views

To filter search results, use the element. The header should be in the section of the search results:    Search results                                                                      

Strange cursor placement in modal when using autofocus in Internet Explorer with HTML

Samual Sam
Updated on 28-Jan-2020 08:29:35

76 Views

To solve this problem, use the following:.modal.fade {    transition:opacity .3s linear; }You can also solve it by forcing the modal to fade in without sliding.windowClass: 'modal fade in'

HTML5

Lakshmi Srinivas
Updated on 28-Jan-2020 08:31:19

463 Views

Use Mediaplayer of Android for playing audio. You need to call function of Android from JavaScript that you have written in HTML file.WebView wv = (WebView) findViewById(R.id.webview); wv.addJavascriptInterface(new WebAppInterface(this), "Android"); public class WebAppInterface {    Context mContext;    WebAppInterface(Context c) {       mContext = c;    }    @JavascriptInterface    public void showToast(String toast) {       Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();    } }The following is my JavaScript:    function showAndroidToast(toast) {       Android.showToast(toast);    }

How to set focus on a text input in a list with AngularJS and HTML5

karthikeya Boyini
Updated on 28-Jan-2020 08:30:41

346 Views

To set focus on a text input in a list, try the following code:newApp.directive('focus', function () {    return function (scope, element, attrs) {       attrs.$observe('focus', function (newValue) {          newValue === 'true' && element[0].focus();       });    } });The following is the HTML:{{cue.isNewest}}

What is getContext in HTML5 Canvas?

Lakshmi Srinivas
Updated on 28-Jan-2020 08:30:13

1K+ Views

The canvas element has a DOM method called getContext, used to obtain the rendering context and its drawing functions. This function takes one parameter, the type of context 2d.Following is the code to get required context along with a check if your browser supports element:var canvas = document.getElementById("mycanvas"); if (canvas.getContext){    var ctx = canvas.getContext('2d');    // drawing code here    } else {    // canvas-unsupported code here }

Cancels ongoing watchPosition call in HTML5

Nitya Raut
Updated on 28-Jan-2020 08:28:19

174 Views

The clearWatch method cancels an ongoing watchPosition call. When canceled, the watchPosition call stops retrieving updates about the current geographic location of the device.                    var watchID;          var geoLoc;          function showLocation(position) {             var latitude = position.coords.latitude;             var longitude = position.coords.longitude;             alert("Latitude : " + latitude + " Longitude: " + longitude);          }          function errorHandler(err) ... Read More

Error codes returned in the PositionError object HTML5 Geolocation

karthikeya Boyini
Updated on 28-Jan-2020 08:27:49

226 Views

The following table describes the possible error codes returned in the PositionError object:CodeConstantDescription0UNKNOWN_ERRORThe method failed to retrieve the location of the device due to an unknown error.1PERMISSION_DENIEDThe method failed to retrieve the location of the device because the application does not have permission to use the Location Service.2POSITION_UNAVAILABLEThe location of the device could not be determined.3TIMEOUTThe method was unable to retrieve the location information within the specified maximum timeout interval.Following is a sample code, which makes use of the PositionError object. Here errorHandler method is a callback method:function errorHandler( err ) {    if (err.code == 1) {     ... Read More

What are Character Entities in HTML5

Samual Sam
Updated on 30-Jul-2019 22:30:22

84 Views

Some characters are reserved in HTML5. For example, you cannot use the greater than and less than signs or angle brackets within your text because the browser could mistake them for markup.HTML5 processors must support the five special characters listed in the table that follows.SymbolDescriptionEntity NameNumber Code"quotation mark""'apostrophe''&ersand&&greater-than>>

How to delete Web Storage?

karthikeya Boyini
Updated on 28-Jan-2020 08:11:29

225 Views

Storing sensitive data on local machine could be dangerous and could leave a security hole. The Session Storage Data would be deleted by the browser immediately after the session gets terminated.To clear a local storage setting you would need to call localStorage.remove('key'); where 'key' is the key to the value you want to remove. If you want to clear all settings, you need to call localStorage.clear() method.                    localStorage.clear();          // Reset number of hits.          if( localStorage.hits ){         ... Read More

Advertisements