i’m not familiar with jquery.
What i’m trying to do is, drag and drop a text which will be displayed as a checkbox and the checkbox should have the id and tooltip same to the dropped-text. For that i used the following code.but it’s not working.please help
<script type="text/javascript">
$(init);
function init() {
function addColumn(column)
{
var iHtml;
//Labeling and Tool Tip the Checkbox
iHtml = "<span title='ToolTipText'>"+
"<input id='<%" + column + ".ClientID%>' type='checkbox' name='<%" + column + ".ClientID %>' />"+
"<label for='<%" + column + ".ClientID%>'>MyCheckBox</label></span>";
return iHtml
}
There are lots of problems with that code. For one thing, although HTML5 allows just about any character in an
idother than a space, earlier versions of HTML were more restrictive and CSS still is, so you really don’t want to start anidwith a#. (You can avoid using anidentirely in this case, unless you need theidfor code you haven’t quoted.) Yourinputtype has a typo (“checbox”) and so it won’t be a checkbox, it’ll default to “text”.Here’s my best guess at what you want:
…but I’m not at all sure your ASP.Net aspects in there are right (I’ve left it as you had it), looks dodgy to me but I don’t do a lot of ASP.Net. (Not least the fancy
”character.)What I did above:
idandnamestart with anxand got rid of the#. See the links above for why. (I left theidbecause I wasn’t sure you didn’t need it; if you don’t need it, if thenameis enough, you can remove it.)inputinside thelabel. When you do that, you can avoid the wholeforthing.titleon thelabel, no need for an extraspan.type.