By using the # character in your selector, you're indicating that you
are targeting the element by ID. Having multiple items on a page with
the same ID will not work.

I would suggest you create a special class for these selects and then
target them that way.

example:

<select class="priority" id="someuniquevalue" name="someuniquevalue">
<options go here>
</select>

> $(document).ready(function(){
>         $("select.priority").change(function() {
>
>                 jQuery.ajax({
>             data: "prio=" + $(this).val() + "&ID=1",
>             url: "do_priority.asp",
>             timeout: 2000,
>             error: function() {
>               console.log("Failed to submit");
>             },
>             success: function(r) {
>               $(this).removeAttr("disabled");
>             }
>           });
>
> $(this).attr("disabled", "disabled");
>
>         });
>
> });


On Nov 5, 6:18 am, williamstam <[EMAIL PROTECTED]> wrote:
> hi
>
> i hope somone can help
>
> i have a couple of records which all have (the idea anyways) have
> select boxes. when a user changes the select box it submits those
> changes and the record ID to another page using ajax to update the
> database. so far i have
>
> $(document).ready(function(){
>         $("#priority").change(function() {
>
>                 jQuery.ajax({
>             data: "prio=" + $("#priority").val() + "&ID=1",
>             url: "do_priority.asp",
>             timeout: 2000,
>             error: function() {
>               console.log("Failed to submit");
>             },
>             success: function(r) {
>               $("#priority").removeAttr("disabled");
>             }
>           });
>
> $("#priority").attr("disabled", "disabled");
>
>         });
>
> });
>
> it works like a charm with 1 record... as soon as there are more
> records it fails. i presume this is cause its finding multiple '$
> ("#priority")' select boxes in the page?
>
> the above code when you change the value of a select box it disables
> the box till ajax says that it "worked" then re enables it again.
>
> regards
>
> william

Reply via email to