Jump to content

jQuery val() Not Working on Object


anevins

Recommended Posts

Hello,

 

I want to clear the content in my HTML input fields, that have the class name 'gllr_image_video_url'.

 

My

document.write()

is only for testing.

 

 

document.write(jQuery(this))

Returns five objects of my input fields, but I can't grab the values.

 

When I do this

document.write(jQuery(this).val())

The document.write never gets executed.

 

I'm just trying to set the value to nothing (below), if the value of the input is equal to that of a string, 'Video URL'.

 

 


// Gallery input url focus
jQuery(document).ready(function() {
var url_input = jQuery('input.gllr_image_video_url');
jQuery(url_input).each(function() {

	jQuery(this).focus(function(){
		document.write(jQuery(this).val());
		if (jQuery(this.val()) == 'Video URL'){ 
			jQuery(this.val()) = '';
		}
		else {
			//
		}

	});

});
});

 

Any ideas why this isn't happening?

Link to comment
https://forums.phpfreaks.com/topic/266489-jquery-val-not-working-on-object/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.