Data-bind for style not working in knockout js - html

myfiddle
style binding not works in knockout js. I dont know why its not working?
code :
<div class="sample" data-bind="style:{color:'blue'}">
hai
</div>
Please help me.

You forgot to call ko.applyBindings().
See fiddle

Related

how to make image with lazyloudin and style from css class?

The code doesn't work, why ?and where's the mistake? Thanks in advance.
I want to do this using css and html only! ( No js ,I want use naitve lazylouad in chrome).
<img loading='lazy' class='preview' src='images/demo/spring-8fb8662b.svg' alt=''>

button href is ignoring everything after question mark

I have this button
<button href="account.html?gto=4356">go to</button>
On click it redirects to ./account.html?# though i was expecting ./account.html?gto=4356.
Why is it ignoring everything after the question mark and how can I make this work?
Button tag does not support href attribute. instead use a tag and css design to make it look like a button.
go to
Hope it will help you.
You can do it with Javascript
<button onclick='goto()'>go to</button>
<script>
function goto(){
location.replace("account.html?gto=4356");
}
</script>
You Have to do it like this
<button>go to</button>
I hope this works for you! regards

div onclick doesn't work for some reason

It's a very simple question and I'm amazed how is this not working for me, somehow this code:
<div id="logoutDiv" onClick="php_includes/logout.php"></div>
doesn't work, when I press on the div. What's the problem? I know that this is a very basic question, but somehow I've got stuck on it.
onclick is a JavaScript event. What you wrote is not JavaScript.
Maybe:
onclick="window.location.href='php_includes/logout.php';"
onClick only works with Javascript, not with links. Try this instead:
<div id="logoutDiv"></div>
Use window.location to call another page. <div id="myButton" onclick="window.location = 'php_includes/logout.php';">Page 2</div>

Angular. html injecting from tinymce

In my admin panel i got tinymce textarea. I want to preview all my changes.
i get html from tinymce
$scope.text_in = tinymce.get('myTextAreaName').getContent();
and it looks like:
<h1 style="text-align: center;">AAA</h1>
<h3 style="text-align: center;">BBB</h3>
I'm using ngSanitize and my element where i want to inject HTML
<div class="new" ng-bind-html="text_in"></div>
Thats looks ok, BUT. I got html markup without inline styles. All other styles from css works fine.
When i inspecting element there are
<h1>AAA</h1>
<h3>BBB</h3>
What am i doing wrong?
According to Angular documentation you can by pass the sanitize.
http://docs.angularjs.org/api/ngSanitize.$sanitize

Force cursor:pointer for link in a div with contenteditable attribute in IE

We are using ckeditor in our project and have spotted following issue:
We should show pointer cursor for links within editor (as designed). It works for all browsers except IE.
Simplified HTML:
<div contenteditable="true">
Link to some site
</div>
In IE (tested in v.8 and v.10) it doesn't work.
Any ideas how it can be achieved in IE?
how about assigning cursor:pointer; for <div contenteditable="true"> ?
alternatively, you can also do it with jQuery:
$(function(){
$('[contenteditable="true"]').css('cursor','pointer');
});
hope that helps.