I just realized I may need to explain a little further.

I've got a table on the same page. Clicking on a record in that table
populates a small form on the page with the information from that
record. The text and check boxes are easy enough to populate, but
telling the select box which of it's options is now selected as a
result of that user click is a little harder it seems.

The code snippet in my original post fires when a user clicks on a
record in the table, and in FireFox 3.0.6 it works just fine, but in
IE6 and IE7 it fails. I should also probably mention that I'm using
jquery 1.2.6 packed.

Thanks,
Chris

On Feb 26, 3:11 pm, Chris Jordan <chris.s.jor...@gmail.com> wrote:
> Hi folks,
>
> I'm trying to manipulate which item in a select box is selected using
> jQuery. The following code snippet works great in FF but fails miserably in
> IE6 and IE7
>
>  // select the publish to option
> $("#PublishToID > option").each(function(){
>     $this = $(this);
>     if($this.attr("textContent") == PublishTo){
>         $this.attr("selected", true)
>     }
>
> });
>
> Given that I have a select box that looks like this:
>
> <select name="PublishTo" id="PublishToID">
>     <option value="3">Some Page Title</option>
>     <option value="4">Some Other Page Title</option>
>     <option value="5">Page 5</option>
>     <option value="1">Page 1</option>
>     <option value="2">Page 2</option>
> </select>
>
> --http://cjordan.us

Reply via email to