Menu

Maslosoft Binder Logo Maslosoft Binder Documentation
Knockout JS tracker and binding handlers with coffee and sugar

Edit

Text Value

Text Value binding handler is similar to HTML Value binding, but it will not allow HTML. All tags will be converted to it's entities values.

In other words, placing textValue binding handler on any element will make it behave like a text input.

WARNING: This binding require parent context, like here with with binding

Standard input field:
Below block should be editable and ignore any html from above input:

Relevant code used in examples:

<div data-bind="with: binder.model.TextValue">
	Standard input field: <input data-bind="textInput: text" style="width:50%;"/> <br />
	Below block should be editable and ignore any html from above input: 
	<div data-bind="textValue: text" class="well"></div>
</div>

<script>
	window.onload = (function(){­
		var data = {­
			text: 'Some text, also <b>with</b> <abbr title="HyperText Markup Language">HTML</abbr>'
		­};
		binder.model.TextValue = new Maslosoft.Koe.TextValue(data);
		ko.applyBindings({­model: binder.model­}, document.getElementById('ko-binder'));
	­});
</script>