EntropySink

Technical & Scientific => Programming => Topic started by: ober on August 23, 2011, 04:49:35 PM

Title: JQuery
Post by: ober on August 23, 2011, 04:49:35 PM
I need to pass parameters to a function and it's not working for some reason.  Can I mix normal JS with JQuery stuff?
Code: [Select]
    <script type="text/javascript" src="javascript/jquery-1.5.1.js"></script>
   
    <script type="text/javascript">
    function copyNotification(role, type, location) {
    alert(role);
    $("notifyRole").val(role);
    $("notifyType").val(type);
    $("notifyLocation").val(location);
    };
</script>
It alerts the role properly, but it's not assigning the values.  Do I need to do something for it to recognize the JQuery stuff? 

If it helps, I'm calling it like this:

Code: [Select]
<a href="#" onclick="copyNotification('752', 'freeze', 'pe1v');">
                      <img src="images/copy.png" title="@@Copy" border="0">
                    </a>
Title: Re: JQuery
Post by: Mike on August 23, 2011, 05:08:53 PM
$("notifyRole") is not a valid object.  Did you mean $("#notifyRole")?
Title: Re: JQuery
Post by: ober on August 24, 2011, 07:15:41 AM
Gah... yes.  I copied that shit from stackoverflow.  I didn't even look at that part.

Thanks.