Escaping/encoding single quotes in JSON encoded HTML5 data attributes

George John
Updated on 30-Jul-2019 22:30:22

4K+ Views

To escape single quotes, use json_encode() to echo arrays in HTML5 data attributes.printf('', htmlspecialchars(json_encode(array('html5', ...)), ENT_QUOTES, 'UTF-8'));Or you can also using built-injson_encode(array('html5', ...), JSON_HEX_APOS)

How to check the validity of your CSS

karthikeya Boyini
Updated on 30-Jul-2019 22:30:22

119 Views

Validation is the process of checking something against a rule. When you are a beginner, it is very common that you will commit many mistakes in writing your CSS rules. How will you make sure whatever you have written is 100% accurate and up to the W3 quality standards?If you use CSS, your code needs to be correct. The improper code may cause unexpected results in how your page looks or functions.But if you want to validate your CSS style sheet embedded in an (X)HTML document, you should first check that the (X)HTML you use is valid.Tool to check the ... Read More

Java is also not pure object-oriented like c++

Pythonista
Updated on 30-Jul-2019 22:30:22

451 Views

the main() method in Java code is itself inside a class. The static keyword lets the main() method which is the entry point of execution without making an object but you need to write a class. In C++, main() is outside the class and writing class it self is not mandatory. Hence, C++ is not a pure object oriented language bu Java is a completely object oriented language.

How to write string functions in Java?

Pythonista
Updated on 30-Jul-2019 22:30:22

189 Views

1) take a string from the user and check contains atleast one digit or not:Extract character array from string using toCharArray() method. Run a for loop over each character in array and test if it is a digit by static method isDigit() of character classpublic static boolean chkdigit(String str) { char arr[]=str.toCharArray(); for (char ch:arr) { if (Character.isDigit(ch)) { return true; } } return false; }2.) take ... Read More

How will you explain Python Operator Overloading?

Jayashree
Updated on 30-Jul-2019 22:30:22

309 Views

Every class in Python, whether built-in or user defined is inherited from object class. The object class has a number of properties whose name is preceded and followed by double underscores (__). Each of these properties is a wrapper around a method of same name. Such methods are called special or magic methods.The magic methods __lt__(), __gt__(), __eq__(), __ne__(), etc. are overridden in a class to overload == and != operators respectively.

CSS Grid Rows

Rishi Rathor
Updated on 30-Jul-2019 22:30:22

135 Views

The horizontal line in the following is called Grid Rows.

CSS Grid Gaps

Arjun Thakur
Updated on 30-Jul-2019 22:30:22

130 Views

The space as shown in the following figure, between rows and columns are called Grid Gaps

Storing Credentials in Local Storage

Rishi Rathor
Updated on 30-Jul-2019 22:30:22

1K+ Views

The Local Storage is designed for storage that spans multiple windows and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons.For storing credentials in local storage, on successful login, generate a completely random string unrelated to user credentials. You need to store this in the database. Do not forget to add an expiry date. Pass that string to the JavaScript to be stored in local storage.As long as the local storage credential matches the database and ... Read More

What does language attribute do in <script> tag in Javascript?

Sai Subramanyam
Updated on 30-Jul-2019 22:30:22

1K+ Views

The language attribute is used to mention the scripting language. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute. Yes, it is now deprecated. Here you can see how it was used. Live Demo

How do we specify whether a header cell is a header for a column, row, or group of columns or rows in HTML?

Ankitha Reddy
Updated on 30-Jul-2019 22:30:22

134 Views

Use the scope attribute to implement whether a header cell is a header for a column, row, or group of columns or rows in HTML − Example Live Demo table, th, td { border: 1px solid black; } Cricketers Indian Cricketers Name 1 Sachin Tendulkar 2 Virat Kohli

Advertisements