WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] jQuery val() Not Working (1 post)

  1. Andrew
    Forum Moderator
    Posted 2 years ago #

    Hello,

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

    The
    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.