javascript - jQuery dialog doesn't work inside if condition -
javascript - jQuery dialog doesn't work inside if condition -
this jquery function followed html code.
$(document).ready(function() { $('#submit').click( function() { var size = $('#file')[0].files[0].size; if(size > 100000) { alert("filesize larger. please seek again."); } }); }); <div id="dialog" title="message" style="display: none"> <p>file size larger.</p> </div>
if replace alert()
$( "#dialog" ).dialog();
doesn't work. if place $( "#dialog" ).dialog();
outside if()
works. there workaround problem i'm facing?
any form of help appreciated. give thanks you.
try :
$(document).ready(function() { $('#submit').click( function() { var size = $('#file')[0].files[0].size; if(size > 100000) { document.getelementbyid("dialog").innerhtml = "filesize larger. please seek again.;" } }); }); <div id="dialog" title="message"></div>
demo : http://jsfiddle.net/8l2s4/
hopefully works.
javascript jquery
Comments
Post a Comment