mirror of
https://github.com/CryptKeeperZK/ejs.git
synced 2026-01-10 07:58:26 -05:00
Updates the documentation to add the new selectTag helper
This commit is contained in:
@@ -325,9 +325,25 @@ contentTag('a', 'hey there', {href: 'http://google.com', data: { goTo: 'http://g
|
||||
contentTag('a', 'hey there', {href: 'http://google.com', data_go_to: 'http://google.com'})
|
||||
// => '<a data-go-to="http://google.com" href="http://google.com">hey there</a>'
|
||||
|
||||
contentTag('select', ['geddy', 'alex', 'neil'])
|
||||
// => '<select><option value="geddy">geddy</option><option value="alex">alex</option><option value="neil">neil</option></select>'
|
||||
```
|
||||
|
||||
#### selectTag
|
||||
`selectTagString(optionsArray<Array>, selectedOption, htmlOptions<Object>)
|
||||
|
||||
Creates a HTML select tag using the given `optionsArray` to create HTML option elements.
|
||||
|
||||
`optionsArray` could be an array of strings, numbers or an object with value and text properties to be used for the value attribute and option element content respectively.
|
||||
|
||||
#####Examples:
|
||||
```
|
||||
selectTag(['geddy', 'alex', 'neil'])
|
||||
// => '<select><option value="geddy">geddy</option><option value="alex">alex</option><option value="neil">neil</option></select>'
|
||||
|
||||
selectTag(['open', 'close'], todo.status, { class:'span6', name:'status' })
|
||||
// => '<select class="span6" name="status"><option selected="selected" value="open">open</option><option value="close">close</option></select>'
|
||||
|
||||
selectTag([{value: 1, text: "Text 1"}, {value: 2, text: "Text 2"}], 2)
|
||||
// => <select><option value="1">Text 1</option><option selected="selected" value="2">Text 2</option></select>
|
||||
|
||||
* * *
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ exports.contentTag = {
|
||||
@public
|
||||
@function
|
||||
@return {String} A HTML `select tag` with the given `optionsArray` and `htmlOptions`
|
||||
@description Creates a HTML select tag with using the given `optionsArray` to create HTML option elements.
|
||||
@description Creates a HTML select tag using the given `optionsArray` to create HTML option elements.
|
||||
Example: selectTag(['open', 'close'], todo.status, { class:'span6', name:'status' })
|
||||
@param {Array} optionsArray The array options used to generate the tag elements.
|
||||
It could be an array of strings, numbers or an object with value and text properties to be used
|
||||
|
||||
@@ -80,10 +80,9 @@ exports.tags = {
|
||||
},
|
||||
|
||||
/*
|
||||
* selectTagString(optionsArray<Array>, selectOption, htmlOptions<Object>)
|
||||
* selectTagString(optionsArray<Array>, selectedOption, htmlOptions<Object>)
|
||||
*
|
||||
* Returns a HTML select element created using the given optionsArray and
|
||||
* html attributes given
|
||||
* Creates a HTML select tag using the given `optionsArray` to create HTML option elements.
|
||||
*/
|
||||
selectTagString: function (optionsArray, selectedOption, htmlOptions) {
|
||||
var optionTags = ''
|
||||
|
||||
Reference in New Issue
Block a user