Question

In this dialog window has text box to enter search criteria , once get the result and closing window. if open dialog again, then the text box removed text which entered already and wait for enter the new search criteria. But now its keeping the value...Please advise

jQuery("#producttextarea").val=""; on page load.

and dialog window titlebar color is not chaning , please look into jsfiddle CSS ?

JSFIDDLE

Was it helpful?

Solution

First of all, val is a function, not a variable, requiring $('#producttextarea').val(''); to change the contents. The Jquery dialog is actually something which exists on the page as a hidden div of sorts. If you want to clear out that, you would need to, at the time the dialog is opened, clear out the contents of val. Alnitak's solution works well for this, or you could put it in the click handler, as such:

jQuery( "#popup" ).click(function() {
    jQuery( "#dialog-form" ).dialog( "open" );
    jQuery( "#producttextarea" ).val('');
});

OTHER TIPS

.val is a jQuery function, not a property.

Put this in your dialog's initial settings to erase the contents of that box every time the dialog is opened:

open: function() {
    jQuery('#producttextarea').val('');
}

It should be jQuery("#producttextarea").val("");

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top