Skip to content Skip to sidebar Skip to footer

Set Checkboxes Checked After Page Refresh Based On Checkboxes Values In The Url Querystring

I have a set of checkboxes: HOSPITALS   ).each(function (index) { if(actualValue[1] === $(this).val()){ //or use if(actualValue[1].indexOf($(this).val())>=0){ $(this).prop("checked", true); } }); });

Also note that, in order to access jquery related methods like 'prop', you need to wrap 'this' in '$'. So I updated your code from 'this' to '$(this)'. Also, what us the purpose of using 'bcslocationtype:"Hospital" ' as value. Why do you require 'bcslocationtype' as a value for variable k. Can't you just append k=hospital etc?

Also, you can do the same thing using aspx. I am not sure about the aspx code, but in Coldfusion I would do something like below: Assuming 'k' is the url variable name

 <input name="LocType"type="checkbox" value="Hospital" <cfif isDefined("URL.k") and URL.k eq "HOSPITAL">CHECKED</cfif> />HOSPITALS&#160;&#160;

The code within input tag to peruse is <cfif isDefined("URL.k") and URL.k eq "HOSPITAL">CHECKED</cfif>. It means, if I have a variable called 'k' defined and set in URL scope, and if the value is hospital, make it checked. Convert it into your asp code.

Post a Comment for "Set Checkboxes Checked After Page Refresh Based On Checkboxes Values In The Url Querystring"