How to fill out an HTML form using CSS?

I have an HTML form with radio buttons, checkboxes, text fields and dropdowns. Since I want the user to fill everything in my form, none of the radio buttons and checkboxes are checked, and the text fields are empty.

I would like to write a CSS file that fills out the form with answers (I don't want to change my HTML file). Is it possible?

Would I appreciate an example or any other idea?

Thank!

+3
source share
4 answers

No, It is Immpossible. CSS is for style, not layout, but modifying the layout is required to change the contents of an input field.

, JavaScript, , .

+5

Javascript - . , -sample-, "" , "": - <input type='text' value='First Name' name='emailForm'>, value , .

+1

jQuery, , , CSS.

:

<form ...>
   <input name="firstName" />
   <input name="lastName" />
</form>

jQuery/JavaScript:

$(function () {
  $("input[name=firstName]").val("John");
  $("input[name=lastName]").val("Doe");
});

. jQuery.

+1

CSS -. , . , , , .

:

  • , PHP/ASP.Net, .
  • Javascript/Jquery/MooTools - , , .

, , HTML.

, .

0

Source: https://habr.com/ru/post/1740547/


All Articles