WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] jQuery Value not updating on keyup

[Resolved] jQuery Value not updating on keyup

  • I am trying to complete a plugin I am developing but I am a little stuck on a small piece of code that I have written in jQuery and was wondering if any one can see what I am doing wrong.

    When the text input field for width or height the value is suppose to update a previously set var.

    I have added an alert to see if it has changed the results and see that it is not changing from the default set values.

    Can any one help me correct this please.

    It would be most appreciated, thank you.

    jQuery(document).ready(function(){
    
    	var sizeWidth = 480; // Default for width.
    	var sizeHeight = 320; // Default for height.
    
    	jQuery('input[name="width"]').keyup(function(){
    		var value = jQuery(this).val();
    		jQuery(this).text(value);
    		jQuery(sizeWidth).val(value);
    		alert(sizeWidth);
    	}).keyup();
    
    	jQuery('input[name="height"]').keyup(function(){
    		var value = jQuery(this).val();
    		jQuery(this).text(value);
    		jQuery(sizeHeight).val(value);
    		alert(sizeHeight);
    	}).keyup();
    
    });
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] jQuery Value not updating on keyup’ is closed to new replies.