[RESOLVED]Html element having both text and value properties

 Is there any element that has both text and value properties??

 I want to bind Different values for text and value properties using knockout . 

The requirement is to show the different text and save the different value as we do with the the dropdown options..

Hi Chinna,

As an work around, you can use some delimiter (separator) to store the value in single attribute.

In the example below, I have used ^^ as the delimeter (separator). You can then split the value with this special character(s) and use it as two different values.

You may use single character or multiple characters depending on your data.

value=’asdfasdf^^asdfadsf’

However, html elements also support custom attributes, i.e., you can write your own attributes (which are not defined by browser), but that could trouble the html validation tools. But, with HTML5, you have data- attributes. See this reference:

http://stackoverflow.com/questions/1735230/can-i-add-custom-attribute-to-html-tag

Hi Siva,

   Thanks for the reply.

   

Hi Chinna,

You’re welcome.. Have a nice day!

Regards

Siva

Leave a Reply