Display checked checkbox names without form tag

Hi everyone …:). I have problem in my program.

I have hashmap i.e. collection ,

my code is as follows

<%! private HashMap<Integer, Domain>domainmap; %>
<table border="1">
			<c:forEach var="domain" items="${domainmap}">
				<input type=checkbox  name="check" id="checkId" value="${domain.value.domainName}"/>
				<c:out value="${domain.value.domainName}"></c:out>


so, i want to display all seleced checked checkbox names, when i click on button but without using FORM tag… please, waiting for your reply

Are you trying to get the “name” attribute of the checked checkbox? Are you using jquery? If yes then it is really simple…


<script type="text/javascript">

$(document).ready(function() {
        var checkedNames = '';
            checkedNames = checkedNames != '' ? checkedNames+', ' : checkedNames;
            checkedNames += $(this).attr("name");
        return false;



            <td witdh="50px"><input name="one" type="checkbox" value="G" /></td>
            <td witdh="200px">One</td>
            <td witdh="50px"><input name="two" type="checkbox" value="G" /></td>
            <td witdh="200px">Two</td>
            <td witdh="50px"><input name="three" type="checkbox" value="G" checked="checked" /></td>
            <td witdh="200px">Three</td>
            <td witdh="50px"><input name="four" type="checkbox" value="G" /></td>
            <td witdh="200px">Four</td>
            <td witdh="50px"><input name="five" type="checkbox" value="G" checked="checked" /></td>
            <td witdh="200px">Five</td>
            <td witdh="50px"><input name="six" type="checkbox" value="G" /></td>
            <td witdh="200px">Six</td>

    <a href="#" id="getnames">get names</a>

What does the generated HTML look like? JavaScript interacts with the HTML the browser sees and not with the server side language that is run on the server to generate the HTML.

Also it is invalid HTML for an <input> field to not be wrapped in side a block level tag that is in turn wrapped in a <form> tag (unless you are writing HTML 3.2 in which case the <input> tag may be directly inside the <form> tag).