18.5k views
0 votes
Which of the following methods removes all the spaces before and after an entry in a text box?

options:

a. val()

b. trim()

c. text()

d. select()

User Emm
by
7.8k points

1 Answer

5 votes

Final answer:

The correct method to remove all spaces before and after an entry in a text box is 'trim()'. This method is specifically designed to trim whitespace from the beginning and end of a string.

Step-by-step explanation:

The method that removes all the spaces before and after an entry in a text box is trim(). The val() method is used to get the value of form elements, the text() method sets or returns the text content of selected elements, and the select() method is used to select the text in the text box. Therefore, b. trim() is the correct option.

User Piotr Byzia
by
7.5k points