Krantik Chavan has Published 308 Articles

Client side validation with HTML and without JavaScript

Krantik Chavan

Krantik Chavan

Updated on 29-Jan-2020 10:53:36

158 Views

To display HTML5 client-side validation error bubbles, use the required attribute.You do not need to have javascript for client side validations like empty text box would never be submitted because HTML5 introduced a new attribute called required which would be used as follows and would insist to have a value: ... Read More

Attributes and usage of

Krantik Chavan

Krantik Chavan

Updated on 29-Jan-2020 08:40:07

505 Views

The HTML5 and tags make it simple to add media to a website. You need to set src attribute to identify the media source and include a controls attribute so the user can play and pause the media.The HTML5 video tag can have a number of attributes to ... Read More

Which punctuation character can be used as the delimiter between MySQL time parts?

Krantik Chavan

Krantik Chavan

Updated on 29-Jan-2020 06:50:19

50 Views

As in the case of date values, MySQL also permits us to use a relaxed format for time. We can use any punctuation character between time parts as a delimiter. Some examples are as follows −mysql> Select timestamp('2017-10-20 04+05+36'); +----------------------------------+ | timestamp('2017-10-20 04+05+36') | +----------------------------------+ | 2017-10-20 04:05:36     ... Read More

Not able to get the value of radio select setting dynamically in AngularJS

Krantik Chavan

Krantik Chavan

Updated on 29-Jan-2020 06:34:33

141 Views

To get the value of radio select, add [$index] to each ng-model like the following: India USThe above would give you the result dynamically in AngularJS.

In MySQL, how can I insert date and time automatically while inserting NULL values to the other columns?

Krantik Chavan

Krantik Chavan

Updated on 29-Jan-2020 05:20:45

725 Views

In MySQL, we can insert current date and time automatically to a column on inserting the NULL values in other columns by declaring that column as DEFAULT CURRENT_TIMESTAMP. In this case, we cannot declare the column NOT NULL in which we want to insert NULL values.mysql> Create Table Testing1(Name Varchar(20), ... Read More

Chrome and HTML5 GeoLocation denial callback

Krantik Chavan

Krantik Chavan

Updated on 28-Jan-2020 10:06:05

101 Views

For timeout callback in Google Chrome, try the following code:_callback = false; function successCallback(position) {    _callback = true;    console.log('success'); } function errorCallback(error) {    _callback = true;    alert('error'); } setTimeout(function(){if(!_callback)console.log('ignored')}, 20000); navigator.geolocation.getCurrentPosition(    successCallback,    errorCallback,    {timeout: 2000} );

How to either determine SVG text box width or force line breaks after 'x' characters?

Krantik Chavan

Krantik Chavan

Updated on 27-Jan-2020 07:26:08

130 Views

Use the getBBox() function and add a single word at a time to a text object. When it gets too wide, you need to add a line feed.var a = Raphael(500, 500); var b = a.text(100, 100).attr('text-anchor', 'start'); var maxWidth = 100; var content = "Lorem ipsum dolor sit amet, ... Read More

Match any single character in the given set.

Krantik Chavan

Krantik Chavan

Updated on 20-Jan-2020 11:00:37

49 Views

To match any single character in the given set with JavaScript RegExp, use the [aeiou] metacharacter.Example           JavaScript Regular Expression                        var myStr = "Welcome to our website!";          var reg = /[we]/g;          var match = myStr.match(reg);                    document.write(match);          

How can I add debugging code to my JavaScript?

Krantik Chavan

Krantik Chavan

Updated on 17-Jan-2020 11:06:09

107 Views

To add debugging code to JavaScript, use the alert() or document.write() methods in your program. For example, var debugging = true; var whichImage = "widget"; if( debugging ) alert( "Calls swapImage() with argument: " + whichImage ); var swapStatus = swapImage( whichImage ); if( debugging ) alert( "Exits ... Read More

How to determine if an argument is sent to the JavaScript function?

Krantik Chavan

Krantik Chavan

Updated on 07-Jan-2020 10:29:12

59 Views

To determine if an argument is sent to function, use “default” parameters.ExampleYou can try to run the following to implement itLive Demo                    function display(arg1 = 'Tutorials', arg2 = 'Learning') {             document.write(arg1 + ' ' +arg2+"");          }          display('Tutorials', 'Learning');          display('Tutorials');          display();          

Advertisements