jquery attr not working in chrome? -


var select_tag = $('<select></select>').attr( {     onchange: 'creatediscipline()',     class: 'select_menu'} ).fadein('slow'); 

this works in ff not chrome. happens in chrome class set, createdisicipline() isn't.

is wrong way add multiple attrs tag? work in ff :/

entire code:

var select_tag = $('<select>', {                     onchange: creatediscipline,                     'class': 'select_menu'}                 ).fadein('slow');             for(i = 0; < c_data.length; i++) {                 select_tag.append('<option>' + c_data[i] + '</option>');             }              //wrap select_tag in div             var div_buffer = $('<div class=\'select_buffer\'></div>');             var div_container = $('<div class=\'select\'></div>');             div_buffer.append(select_tag).wrap('<div class=\'select_buffer\' />');             div_container.append(heading);             div_container.append(div_buffer);              //append page after right_content id             $('#right_content').append(div_container) 

you should not try bind event handler this. unobtrusive way:

var select_tag = $('<select>', {     change:  creatediscipline,     'class': 'select_menu' }).appendto(document.body).fadein('slow'); 

notice changes. wrapped class in quotes because keyword in internetexplorer , may break code otherwise. appended newly created <select> node document.body.

demo: http://jsfiddle.net/vm5hp/


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -