jQuery set value only if empty -


I am using a model to set a default value for a series of text box fields. However, I only want to set the field in the default value if a value does not already exist. Is there a way to do this with a jQuery selector?

Current Code

  var fooVal = $ ('# cboxLoadedContent'). ('#SetFoo') Val () .; Var barVal = $ ('# cboxLoadedContent'). ('# Setbar'). Val (); $ ('.foo') val (fooVal) $ ('Bar') bar (BarVal).  

  $ (".foo [value = '']"). Valve (fooVal);  Edit:  As Jonathan is described by you if you are using more than text input for this, then you need to be a bit more advanced ... especially the selection tag , But also checkboxes, radios and taxresus 


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -