How do you select element by ID in jQuery?

Answer Posted / chaitanya

To select element use ID selector. We need to prefix the id with "#" (hash symbol). For example, to select element with ID "txtName", then syntax would be,

Hide Copy Code

$('#txtName')

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is jquery datepicker in jquery?

461


How to select all elements using jQuery?

528


Can you please explain the difference between prop and attr? : jquery mobile

417


Explain .empty() vs .remove() vs .detach() in jquery

433


What are jquery selectors?

483






What is a filter in jquery? Explain

501


What is serialize() in jquery?

454


What is the basic requirement to start with the jquery?

506


What is the difference between $.map and $.grep in jQuery?

477


Explain the use of each function in jquery?

3812


What is difference between .setinterval() and .delay() ?

444


Why content injected into a page is not enhanced? : jquery mobile

441


What does jQuery data() function do?

534


Explain the script build up by jquery?

8900


In what scenarios jQuery can be used?

506