One of the eligibility requirements for the child and dependent care credit states that the childcare must be provided so you (and your spouse if filing jointly) could work or look for work. However, if your spouse did not have a job and had no earned income, you still may take the credit if he or she was a full-time student or disabled.
Per IRS Instructions for Form 2441 Child and Dependent Care Expenses, page 4:
If You or Your Spouse Was a Student or Disabled
Your spouse's earned income. Your spouse was a full-time student if he or she was enrolled as a full-time student at a school for some part of each of 5 calendar months during 2023. The months need not be consecutive. A school doesn't include an on-the-job training course, a correspondence school, or a school offering courses only through the Internet. Your spouse was disabled if he or she wasn't physically or mentally capable of self-care. Figure your spouse's earned income on a monthly basis.
For each month or part of a month your spouse was a student or was disabled, he or she is considered to have worked and earned income. His or her earned income for each month is considered to be at least $250 ($500 if more than one qualifying person was cared for in 2023). Enter that amount on line 5. If your spouse also worked during that month, use the higher of $250 (or $500) or his or her actual earned income for that month.
To access Form 2441 and report spouse as student or disabled in the TaxAct program (if you need help accessing Form 2441, go to our Form 2441 - Entering Child and Dependent Care Expenses in Program FAQ):
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the webpage or document at the time it is accessed.