Categories
HTML JavaScript jQuery

How to Find an Element by Name with jQuery

We can find an element with the given name with jQuery by using the $ itself.

For instance, if we want to find something with the name foo, we can write:

$('[name=foo]')

The general form of this CSS selector is:

[attribute=value]

In the example above name is the attribute and foo is the value of the name attribute.

Then that will return the element with the name foo.

Once we did that, if the element exists on the page, then we can do anything with it like adding/removing classes, adding/removing styles, and so on.

Categories
HTML JavaScript jQuery

How to Find an Element by ID with jQuery

We can find an element with the given ID with jQuery by using the $ itself.

For instance, if we want to find something with ID foo, we can write:

$('#foo')

Then that will return the element with the ID foo.

Once we did that, if the element exists on the page, then we can do anything with it like adding/removing classes, adding/removing styles and so on.

Categories
HTML

Is there an input with Type textarea?

There isn’t a input with type textarea.

Instead, we use the textarea tag to create a text area.

This lets us enter text that has multiple rows and longer than an input would allow.

For instance, we can write;

<textarea rows="5" cols="50">

to display a text area with 5 rows and 50 columns wide.

We should pair that with a label tag for better accessibility.

We can write:

<label for="diary">Diary:</label>
<textarea id="diary" rows="5" cols="50">

The value of the for attribute of label should match with the id of the textarea element.

Then everyone including people that rely on screen readers will know what we should enter in the text area.

Categories
HTML

HTML5 Tags List

HTML5 introduced many new tags. The HTML5 tags list is below:

Structural Tags

Structural tags are for defining the structure of the page. They’re all semantic and provides no formatting.

  • article – defines an article
  • aside – holds some content that’s loosely related to the page content
  • details – a widget from which user can get addition information or controls on demand
  • header – header of a document or section
  • hgroup – a group of headings
  • footer – a footer of a document or section
  • section – a section of a document
  • summary – summary for the details element

Form Tags

These tags are for form structure or controls.

  • datalist – a set of predefined options for an input element
  • keygen – a control for generating a public-private key pair
  • meter – a scalar measurement within a known range

Formatting Tags

These tags are for formatting page content,

  • bdi – text that’s isolated from the surrounding for the purpose of bidirectional text formatting
  • mark – text highlighted for reference purposes
  • output – represent the result of a calculation
  • progress – displays a completion progress of a task
  • rp – provides fallback parentheses for browsers that don’t support ruby annotations
  • rt – defines the pronunciation of characters presented in ruby annotations
  • ruby – defines ruby annotation for pronunciation
  • wbr – a line breaks opportunity

Embedded Content Tags

  • audio – lets us embed sound or audio stream in an HTML document
  • canvas – a region in a document which can be used to draw graphics on the fly
  • embed – embed external application like multimedia content into an HTML documentation
  • figcaption– defines caption or legend for a figure
  • figure – represents a figure as part of a document
  • source – alternative media sources for audio and video
  • time – represents a time or date
  • video – embeds video content in HTML documents
Categories
HTML

How to Insert MP4 Video in HTML

Inserting MP4 videos in our HTML code is easy.

All we have to do is to use the video tag as follows:

<video src='https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_640_3MG.mp4' controls></video>

We have the controls attribute to show the video play controls in our video element.

src has the path to the video. It can be either a URL or a relative path.

Once we have that, we’ll see the video displayed with the play button on the bottom left.