Friday, April 15, 2011

xajax and select

I have a bit of simple created with XAJAX, which replaces the innner HTML of a select control with some options created by a php script.

This is fine and dandy in Firefox, but it does not work in IE7.

Looking on the XAJAX forums i found this which basically says " doesnt really work in IE, use a div and replace the inner HTML of that with the full select statement"

Did this, and it's fine, except that i had a jQuery selector working on the select control, which now no longer works.

Anyone got any ideas, or can anyone point me to a good jQuery example of how to do the ajax bit using jQuery, so I can ditch the XAJAX altogether?


EDIT:

<div id=imgselect>
  <select id="images">
   <option value="">Then select an image</option>
  </select>
</div>


Picture Preview:<br><br>

 <div class="img-preview" id='preview'></div>
 <script type='text/javascript'>
   $('#images').change(function() 
   {
     var image = $(this).val();
     var img = $('<img/>').attr('src', image);
    $('#preview').html(img);

    document.getElementById('picsmall').value = image;
    });
</script>

The problem comes when the contents of the imgselect div is replaced by the AJAX call

From stackoverflow

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.