0

I'm having a problem, I have a button on page1 that when clicked passes this url:

http://www.example.com/page1.html?jquery=blogger

once it's clicked will go to page2 where there are checkboxes. I need the checkbox associated with "blogger" (named: cf_538) to be checked once the page loads.

<script type="text/javascript">
<!--

var koko = querySt("jquery");


if (koko == 'blogger'){


document.order.cf_538.checked = true;

alert('thank you for showing interest in our start up package');

}else{

alert('thank you for showing interest in our services');

} 

-->
</script>

However when I do this, nothing happens but the alert. The check box is not checked. Any help would be greatly appreciated.

Regards, Hal

1
  • You're going to have to provide considerably more information in order for anybody to help. What does the markup look like? Commented May 26, 2010 at 18:50

2 Answers 2

2

By "named cf_538" do you mean the name attribute?

If so:

$("[name=cf_538]").attr("checked", "checked");
Sign up to request clarification or add additional context in comments.

Comments

1

Since you have the topic marked jQuery:

$('input[name=cf_538]').attr('checked', true);

and is 'order' the name of your form? Your

document.order.cf_538.checked = true; 

would work in the case of

<form name="order">
    <input type="checkbox" name="cf_538" />
</form>

--

document.getElementById('order').cf_538.checked = true;  

would work in the case of

<form id="order">
    <input type="checkbox" name="cf_538" />
</form>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.