0

I am binding the selected values of autocomplete box into a div tag as

var data = "<div class='close'><table><tr><td rowspan='4' width='50px;'><img src='" + studentItem.Photo + "' Width='48' Height='48'  /></td><td>" + studentItem.Name + " ( <span class='stuId'>" + studentItem.StudentId + "</span> )</td><td align='right' ><div id='close' class='close16'/></td></tr><tr><td><table cellpadding='0' cellspacing='0'><tr><td>" + studentItem.Email + "</td><td>&nbsp;|&nbsp;</td><td>" + studentItem.Mobile + "</td></tr></table></td></tr></table></td></tr></table></div>";
            $('#students').css('background-color', '#FFAA55');
            $("#students").append(data);

and its binding the datas and displyaing in the div tag as

enter image description here

I want the each record should be in a seperate box, for example look at tag box in our stackoverflow

enter image description here

i want the result should be like this above.......I even tried to include the div script into a table, but it displays the single record in a whole row, and for the second record it comes to the second row,and I tried including the css inline,that also not working... how can I fix this, can anyone help me..

I tried to set the margin and float style to my div tag as

<tr>
    <td colspan="10" >
        <div id="students" style="float: left; clear: both; margin: 25px"></div>
    </td>
</tr>

i tried by setting the margin as 25px for testing purpose and now the output is

enter image description here

just the space coming between the textbox and div not among records within div, how can I fix this....

4

3 に答える 3

2

ボックスを区切るには、を使用しますmargin。それらを並べて並べるが、折り返すには、float: leftその後にclear: both要素を使用するか、を使用しますdisplay: inline-block

于 2012-04-10T10:30:04.750 に答える
1

他のjQueryプラグインを使用できる場合は、これが役立つ可能性があります:jQuery Autosuggest

于 2012-04-10T10:30:49.873 に答える
1

<table>varデータで作成する必要はありません。あなたは外に置くことができます<table>そしてあなたが追加するたび<td><table><tr>タグを追加するだけです。

<div>それ以外の場合は、状況に応じて複数使用します。

        <div id="Adddiv" runat="server" clientidmode="Static" >
        </div>

        ===============jQuery============
        var html = "<div id='Adddata'>";
        html += "<a herf='#' style='cursor: pointer;'>";
        html += "<img src='close.png' alt='' /></a>";
        html += "</div>";

        $("#Adddiv").append(html);
于 2012-04-10T10:31:32.480 に答える