Categories
HTML

How to tell Google Translate to not translate a section of a website?

Sometimes, we want to tell Google Translate to not translate a section of a website.

In this article, we’ll look at how to tell Google Translate to not translate a section of a website.

How to tell Google Translate to not translate a section of a website?

To tell Google Translate to not translate a section of a website, we can add the notranslate class to the elements with text that we don’t want to translate.

For instance, we write

Welcome to the <span class="notranslate">cool</span> company website!

to not translate ‘cool’ in the span by adding the notranslate class to the span.

Conclusion

To tell Google Translate to not translate a section of a website, we can add the notranslate class to the elements with text that we don’t want to translate.

Categories
HTML

How to add tooltips for cells in HTML table?

Sometimes, we want to add tooltips for cells in HTML table.

In this article, we’ll look at how to add tooltips for cells in HTML table.

How to add tooltips for cells in HTML table?

To add tooltips for cells in HTML table, we add the title attribute to our table elements.

For instance, we write

<td title="This is Title">...</td>

to set the title attribute to the tooltip text in the td element.

Then when we hover the cell, the tooltip text would be the title attribute value.

Conclusion

To add tooltips for cells in HTML table, we add the title attribute to our table elements.

Categories
HTML

How to impose maxlength on text area in HTML?

Sometimes, we want to impose maxlength on text area in HTML using JavaScript.

In this article, we’ll look at how to impose maxlength on text area in HTML using JavaScript.

How to impose maxlength on text area in HTML?

To impose maxlength on text area in HTML using JavaScript, we can set the maxlength attribute of the input.

For instance, we write

<!DOCTYPE html>
<html>
  <body>
    <form action="processForm.php" action="post">
      <label for="story">Tell me your story:</label><br />
      <textarea id="story" maxlength="100"></textarea>
      <input type="submit" value="Submit" />
    </form>
  </body>
</html>

to set the maxlength attribute of the textarea element to 100 characters.

Conclusion

To impose maxlength on text area in HTML using JavaScript, we can set the maxlength attribute of the input.

Categories
HTML

How to disable drag and drop on HTML elements?

Sometimes, we want to disable drag and drop on HTML elements.

In this article, we’ll look at how to disable drag and drop on HTML elements.

How to disable drag and drop on HTML elements?

To disable drag and drop on HTML elements, we set the draggable attribute to false.

For instance, we write

<div draggable="false"></div>

to set the draggable attribute to false so that the div can’t be dragged.

Conclusion

To disable drag and drop on HTML elements, we set the draggable attribute to false.

Categories
HTML

How to submit the value of a disabled input field with HTML?

Sometimes, we want to submit the value of a disabled input field with HTML.

In this article, we’ll look at how to submit the value of a disabled input field with HTML.

How to submit the value of a disabled input field with HTML?

To submit the value of a disabled input field with HTML, we replace the disabled attribute with the readonly attribute.

For instance, we write

<input type="text" readonly="readonly" />

to set the readonly attribute to readonly.

This way, the user won’t be able to interact with the input, but the input value will still be submitted.

Conclusion

To submit the value of a disabled input field with HTML, we replace the disabled attribute with the readonly attribute.