...

View Full Version : jQuery Problem with val()



flint0131
01-06-2011, 11:54 AM
I created some function



function someFunction() {
if ( $("input[type=text][name|='url']").val() != "" &&
$("input[type=text][name|='t']").val() != "" &&
$("input[type=text][name|='a']").val() != "" ) {
// someCodes if true


} else {
// someCodes if !true
}
}


and the problem is the if ( $("input[type=text][name|='url']").val() != "" && $("input[type=text][name|='t']").val() != "" && $("input[type=text][name|='a']").val() != "" ) { still be true even if <input type="text" name="url" />, name="t" and name="a" values are blank.

flint0131
01-06-2011, 12:06 PM
ohw ok, nvm.. that was dumb. :/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum