I suppose I looked at my screen for too long today - I cannot find an error here. I have a jQuery template and I use it for beginners. Inside, I have a button, and I'm trying to call the onclick function and pass the iteration value. Here is a snippet from the template. The only thing I can think of would be wrong is something about jQuery template syntax, as it works elsewhere
<button onclick="newTabify(${$data})">Chat</button>
My template looks like this ... (button inside, along with a bunch of other things)
<div data-bind='template: {name: "contactTemplate", foreach:contacts}' id="contactList"></div>
<script id='contactTemplate' type='text/html'>
...
</script>
The newTabify function looks like this:
function newTabify(contact) {
tabify($.inArray(contact, viewModel.contacts()));
}
Extremely weird mistake here.
SCRIPT1007: Expected ']'
default.html, line 1 character 19
Line 1 is my tag <head>
!
If you need more markup, just know. Thanks!
EDIT: . , , click , , . .
{{if $data.jid() != viewModel.jid() }}
<div class="wrapper" onclick="wrapperClick(this)">
<div style="padding-bottom:4px">
<img src=images/${$data.avail}.png> ${ $data.name } <img class="avatar" src=images/${$data.img}><br> <span class="status">${$data.status }</span>
</div>
<a href="mailto:${$data.jid}" >${$data.jid}</a> | <button onclick="newTabify(${$data})">Chat</button> | <button onclick="event.stopPropagation();">Call</button>
</div>
{{/if}}
EDIT 2: $data - ; ( ) .. :
function contact(name, status, avail, jid, img, convIndex){
return {
name : ko.observable(name),
status : ko.observable(status),
avail : ko.observable(avail),
img : ko.observable(img),
jid : ko.observable(jid),
convIndex: ko.observable(convIndex)
};
}
, $data .