javascript - Display the biggest width of element among other three elements inside a Div using Jquery -
i have created dialog using jqueryui. inside dialog have <div>, , inside <div>, have 3 <button>. "delete", "cancel" , "ok". of 3 elements widths different. have not given size myself. sizes getting created according length of word on buttons. want display max width size (in pixel) of element among 3 elements.
$(document).ready(function () { dialog = $("#dialog-confirm").dialog({ autoopen: false, resizable: false, height: 500, width: 500, modal: true, buttons: { "delete": function () { $(this).dialog("close"); }, "cancel": function () { $(this).dialog("close"); }, "ok": function () { var width = $("[aria-describedby='dialog-confirm'] .ui-dialog- buttonpane .ui-dialog-buttonset > button").width(); alert(); } i stuck here.
if you're looking width of widest button, can use this:
dialog = $("#dialog-confirm").dialog({ resizable: false, height: 500, width: 500, modal: true, buttons: { "delete": function () { $(this).dialog("close"); }, "cancel": function () { $(this).dialog("close"); }, "ok": function () { var widest = 0; $('.ui-dialog-buttonset button').each(function () { if ($(this).width() > widest) widest = $(this).width(); }) alert(widest); } } })
Comments
Post a Comment