.net - Update Href of Link button Through Jquery -
i using link button redirect page desired location query string value jquery. link button code follows:
<td> <a id="selectalllink" class="button" rel="nofollow ibox&width=800&height=400&title=contact now" href="#" onclick="return (this.href=='#');">contact selected</a> </td>
and jquery create/update link on click event of link button follows:
function cotactselected() { var = []; var n = $("td.title_listing input:checked"); var s = ""; n.each(function() { a.push($(this).val()); }); var s = a.join(','); if (s != null) { $("@.button#selectalllink").attr("href", "/d_contactseller.aspx?property=" + s); } else { alert("select atleast 1 property contact!"); } }
what wanted collect comma separated value check boxes , pass page collected value query string. on click of link button should carry comma separated values , redirected desired page. kindly me.. in advance.
use instead of function cotactselected
$(function() { $('#selectalllink').each(function() { var = []; var n = $("td.title_listing input:checked"); var s = ""; n.each(function() { a.push(this.value); }); s = a.join(','); if (a.length > 0) this.href= "/d_contactseller.aspx?property=" + s; else this.href = 'javascript:alert("select @ least 1 property contact!");'; return false; }); });
Comments
Post a Comment