Question

Hmm.. have not found an answer to this... so here goes.

  • Want to create a form using Emmet syntax.
  • I have the following list of items:

    firstName
    lastName
    middleInitial
    suffixName
    streetAddress1
    streetAddress2
    streetAddress3
    cityAddress
    stateAddress
    zipCodeAddress
    countryAddress
    phoneNumber1
    phoneNumber1Type
    phoneNumber2
    phoneNumber2Type
    dob
    gender
    maidenName
    
  • I could use something like the following Emmet syntax to create a form:

    form:get.newUserForm>input.formInput[name=FieldName]*

(That may be slightly incorrect.. but that's not the focus of the question.)

The question is..

How can I get each "FieldName" to match the selected item in the list? For example, the first item in my list is "firstName", and the second is "lastName". Is there a way for Emmet to see the list item and use THAT in place of "FieldName" (or "id" for that matter)? So in basic terms.. is there an equivalent to $this (referring to the item in the list) in Emmet?

TTAIA

Was it helpful?

Solution

By default, Emmet inserts wrapped content inside deepest child node of abbreviation, but you can decide where to put wrapped content with $# token.

E.g. you can write something like form:get.newUserForm>input.formInput[name=$#]* to insert strings into name attribute of <input> element.

See http://docs.emmet.io/actions/wrap-with-abbreviation/#controlling-output-position

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top