Css class added but not rendering when applied with jQuery

I'm having a peculiar problem. I'm able to add a css class to a DIV, but the styles are not rendered. **UPDATE**
I finally found the problem. With the code I originally used, I added the class to the 'myDialog' div. What I nedded to do, was to add the class to the parent div which $.dialog creates (to wrap my dialog div). Once this was done, my dialogbox was rendered corectly. Here is the code I use: //Instantiate dialog jQuery("#dialog").dialog({ modal:true, autoOpen:false }); function processRegistration(instanceID, formData) { jQuery.post("wp-content/themes/storelocator/include/jquery_bll.php", { instance: 'processRegistration', formData : formData, instanceID : instanceID }, function(feedback) { jQuery('#dialog').text(feedback.message); jQuery('#dialog').parent().addClass(feedback.type); jQuery('#dialog').dialog('open'); },"json"); }
I don't think it's really "Bad" to re-instantiate the dialog, but as with most things in programming if you can do something only once you probably should. One thing to note, though: I'm pretty sure specifying auto-open as true and then calling open is redundant.

以上就是Css class added but not rendering when applied with jQuery的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准